Add extra delegate to Cordova AppDelegate iOS

ぃ、小莉子 提交于 2019-12-11 06:19:50

问题


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.


回答1:


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


来源:https://stackoverflow.com/questions/48958904/add-extra-delegate-to-cordova-appdelegate-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!