Thepingpp-react-native
module is currently used in the project.
He mentioned in the document that the following code needs to be added to AppDelegate.m,
//iOS 8 及以下 - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { BOOL canHandleURL = [Pingpp handleOpenURL:url withCompletion:nil]; return canHandleURL; } //iOS 9 及以上 - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { BOOL canHandleURL = [Pingpp handleOpenURL:url withCompletion:nil]; return canHandleURL; }
My AppDelegate.m is as follows. Currently, only the iOS9 code has been added. How to add the iOS8 code? It seems that it needs to be merged with the RCTLinkingManager code?
#import "AppDelegate.h" #import #import #import #import "SplashScreen.h" #import "Pingpp.h" @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // 省略 } - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { return [RCTLinkingManager application:application openURL:url sourceApplication:sourceApplication annotation:annotation]; } // 我添加的pingpp iOS9相关代码 - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { BOOL canHandleURL = [Pingpp handleOpenURL:url withCompletion:nil]; return canHandleURL; } @end
If you need to adapt to iOS8, you can judge the version in two ways