Swizzling is better than using a category because it will allow multiple plugins to hook into the method.
On Wed, Jul 16, 2014 at 3:13 AM, julio cesar sanchez <jcesarmob...@gmail.com > wrote: > I've just tested and you can just create an AppDelegate category for > the new methods and this should work, but don't use it for existing > methods on the AppDelegate because you will overwrithe the original > methods and only the category methods will be called. I don't know if > this is better/safer than swizzling > > If you want to execute your own code when some existing method on the > AppDelegate is called, you can use Notifications > > https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006728-CH3-DontLinkElementID_4 > > > > 2014-07-15 21:40 GMT+02:00 Shazron <shaz...@gmail.com>: > > There is an enhancement request for this sort of situation: > > https://issues.apache.org/jira/browse/CB-5601 > > IMO, modifying files through the CLI will be problematic -- what > > happens if N plugins want to modify the AppDelegate for example? > > > > On Tue, Jul 15, 2014 at 12:27 PM, Sergey Grebnov (Akvelon) > > <v-seg...@microsoft.com> wrote: > >> I think this is a good example of why plugin hooks support could be > very useful. > >> > https://github.com/MSOpenTech/cordova-lib/blob/795d40c9c98d1ecef0a63fc81a95d2b070f5bce2/cordova-lib/templates/hooks-README.md > >> https://github.com/apache/cordova-lib/pull/55 > >> > >> PS. Not sure how pushwoosh manages this, I ended up with just > documenting this as a manual step in similar situation. > >> > >> Thx! > >> Sergey > >> -----Original Message----- > >> From: julio cesar sanchez [mailto:jcesarmob...@gmail.com] > >> Sent: Tuesday, July 15, 2014 8:35 PM > >> To: dev@cordova.apache.org > >> Subject: Re: Manual iOS steps for a Cordova plugin... really? > >> > >> I think there are other ways of doing this, take a look into other push > plugins, like the oficial pushplugin or the pushwoosh plugin. > >> > >> I think i've even answered something like this on stackoverflow, I'll > look into this and let you know > >> > >> El martes, 15 de julio de 2014, Michal Mocny <mmo...@chromium.org> > escribió: > >> > >>> You can solve this problem as a plugin author using swizzling. > >>> > >>> Here's an example where we do it with our chrome.identity plugin: > >>> > >>> https://github.com/MobileChromeApps/mobile-chrome-apps/blob/master/chr > >>> ome-cordova/plugins/chrome.identity/src/ios/ChromeIdentity.m#L50 > >>> > >>> Max here was the author so he'd know most about this approach. > >>> > >>> One quick comment, we're not sure (aka seems unlikely) that its > >>> possible to add properties like this, so you'll have to change to > >>> plugin to store its data elsewhere. > >>> > >>> > >>> On Tue, Jul 15, 2014 at 10:50 AM, Lisa Seacat DeLuca > >>> <ldel...@us.ibm.com <javascript:;>> > >>> wrote: > >>> > >>> > So I'm not an iOS developer but wanted to get some insight into this. > >>> IBM > >>> > has a set of cordova plugins for our Bluemix (Cloud Foundry) > offering. > >>> > > >>> > The plugins are available in the plugins repo: > >>> > http://plugins.cordova.io/#/package/com.ibm.mobile.cordova.ibmpush > >>> > > >>> > I was seeing a bunch of errors on the ios side, and when I reached > >>> > out to the team working on bluemix ios cordova plugin they said it's > >>> > not a bug, > >>> I > >>> > need to follow a bunch of *manual steps* to get the ios plugin to > work: > >>> > > >>> > > >>> > > >>> https://mbaas-gettingstarted.stage1.ng.bluemix.net/hybrid#set-up-push- > >>> in-cordova-for-ios > >>> > > >>> > Is this really a requirement? Is there really no way to avoid > >>> > having to have manual steps to add pieces of code into the > >>> > AppDelegate.h and AppDelegate.m files? I find this hard to believe. > >>> > > >>> > "To use the IBMPush Cordova plug-in for iOS, configure the > >>> > AppDelegate of the Cordova application. > >>> > 1. Add the following property to the AppDelegate.h file: > >>> > *@property* (*nonatomic*, *strong*) NSData* token; > >>> > 2. Add the following code snippets to the AppDelegate.m file. > >>> > Import the IBM Push cordova header file. > >>> > *// Import the header file.* > >>> > *#import **"CDVIBMPush.h"* > >>> > Add the following code to the didFinishLaunchingWithOptions method > >>> > to register your application to receive Push notifications. > >>> > -(BOOL)application:(UIApplication*)application > >>> > didFinishLaunchingWithOptions:(NSDictionary*)launchOptions > >>> > { > >>> > *// Register to receive remote notification* [application > >>> > registerForRemoteNotificationTypes: > >>> > UIRemoteNotificationTypeBadge | > >>> > UIRemoteNotificationTypeAlert | > >>> > UIRemoteNotificationTypeSound]; > >>> > } > >>> > ......." > >>> > > >>> > > >>> > Lisa > >>> > > >>> > > >>> > Lisa Seacat DeLuca > >>> > Mobile Engineer | t: +415.787.4589 | *ldel...@apache.org > >>> > <javascript:;>* <ldel...@apache.org <javascript:;>> | | > >>> > *ldel...@us.ibm.com > >>> <javascript:;>* <ldel...@us.ibm.com <javascript:;>> | > >>> > *lisaseacat.com* <http://www.lisaseacat.com/> | [image: follow > >>> > @LisaSeacat on twitter] <http://www.twitter.com/LisaSeacat>| [image: > >>> > follow Lisa Seacat DeLuca on linkedin] > >>> > <http://www.linkedin.com/in/lisaseacat> > >>> >