结合 rn-fbsdk 和 react native 链接 objective-c 代码
Combining rn-fbsdk and react native linking objective-c code
调试后,我发现了为什么我的应用程序没有收到深层链接。
因为脸书代码:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
// Add any custom logic here.
return handled;
}
您认为如何将这些组合起来用于 rn 链接代码,因为这也是必需的:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSString * scheme = (NSString*)url.scheme;
NSString * fbScheme = @"fb123456789";
if ([fbScheme isEqualToString:scheme]) {
return [[FBSDKApplicationDelegate sharedInstance]
application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
} else {
//Your other stuff here
}
}
用这个修复它。
这就是我组合链接的方式,RN fbsdk,RN google signin
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
]
|| [RNGoogleSignin application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
]
|| [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation
];
}
调试后,我发现了为什么我的应用程序没有收到深层链接。
因为脸书代码:
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options {
BOOL handled = [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
];
// Add any custom logic here.
return handled;
}
您认为如何将这些组合起来用于 rn 链接代码,因为这也是必需的:
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
return [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation];
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
NSString * scheme = (NSString*)url.scheme;
NSString * fbScheme = @"fb123456789";
if ([fbScheme isEqualToString:scheme]) {
return [[FBSDKApplicationDelegate sharedInstance]
application:application openURL:url sourceApplication:sourceApplication annotation:annotation];
} else {
//Your other stuff here
}
}
用这个修复它。
这就是我组合链接的方式,RN fbsdk,RN google signin
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [[FBSDKApplicationDelegate sharedInstance] application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
]
|| [RNGoogleSignin application:application
openURL:url
sourceApplication:sourceApplication
annotation:annotation
]
|| [RCTLinkingManager application:application openURL:url
sourceApplication:sourceApplication annotation:annotation
];
}