AppDelegate.m for both FBSDK and LinkingManager

前端 未结 3 1758
失恋的感觉
失恋的感觉 2021-02-20 05:24

To use FBSDK I need this snippet in app delegate

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url 
    sourceApplication:(NSString *)sourceA         


        
3条回答
  •  死守一世寂寞
    2021-02-20 05:52

    Wow, exactly what I was looking for! The accepted answer works great, except for a slight variation, since my FBSDK implementation is different (newer?). Because it uses:
    options:(NSDictionary *)options {

    I just tried to use the same parameters as FBSDK, and it works!

        sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
        annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
    

    Full method:

    - (BOOL)application:(UIApplication *)application
                openURL:(NSURL *)url
                options:(NSDictionary *)options {
    
      BOOL handledFB = [[FBSDKApplicationDelegate sharedInstance] application:application
        openURL:url
        sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
        annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
      ];
    
      BOOL handledRCT = [RCTLinkingManager application:application
        openURL:url
        sourceApplication:options[UIApplicationOpenURLOptionsSourceApplicationKey]
        annotation:options[UIApplicationOpenURLOptionsAnnotationKey]
      ];
    
      return handledFB || handledRCT;
    }
    

    RN 0.59.x

提交回复
热议问题