0

调试后,我发现了为什么我的应用没有收到深层链接。

这是因为fb代码:

- (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-linking 代码组合这些,因为这也是必需的:

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication annotation:(id)annotation
{
  return [RCTLinkingManager application:application openURL:url
                      sourceApplication:sourceApplication annotation:annotation];
}
4

2 回答 2

1
- (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
  }
}

用这个修复它。

于 2017-03-13T09:11:40.020 回答
1

这就是我结合链接、RN fbsdk、RN google 登录的方式

- (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
      ];

}
于 2017-10-29T23:35:18.353 回答