h3nr1ke
h3nr1ke

Reputation: 363

Add extra delegate to Cordova AppDelegate iOS

I am building a plugin to integrate an external framework to an Cordova, following the documentation, I need to include a new delegate to AppDelegate.h of my app.

If was developing a native application, i just need to import the file and include the delegate on it.

#import <MySpinServerSDK/MySpinServerSDK.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate, MySpinServerSDKDelegate>

How can I add a extra delegate to a Cordova App for iOS using the plugin structure?

I did all the preparation in a plugin (external frameworks an plist configuration) but not sure if its possible to create this kind of integration using cordova plugins.

Upvotes: 2

Views: 2251

Answers (1)

Michael Gatto
Michael Gatto

Reputation: 118

You can reference these Cordova Plugins as examples: App-Event or Deep Links

Note how the App Event developer named the new files with a plus sign: AppDelegate+APPAppEvent.h and AppDelegate+APPAppEvent.m in his Cordova plugin. In the header file, the developer used a category "APPAppEvent" while declaring his new class as an AppDelegate:

@interface AppDelegate (APPAppEvent)

@end

The Deep Links developer did the same:

@interface AppDelegate (CULPlugin)

- (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void (^)(NSArray *))restorationHandler;

@end

Upvotes: 3

Related Questions