在将Facebook SDK导入AppDelegate.m文件中需要帮助

时间:2018-10-31 20:23:36

标签: xcode

目前,我正在尝试根据Facebook将以下内容添加到我的appdelegate.m中:

  • (BOOL)应用程序:(UIApplication *)应用程序 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[FBSDKApplicationDelegate sharedInstance]应用程序:应用程序 didFinishLaunchingWithOptions:launchOptions];

    //在此处添加任何自定义逻辑。 返回是; }

  • (BOOL)应用程序:(UIApplication *)应用程序 openURL:(NSURL *)url     选项:(NSDictionary *)选项{

    BOOL处理= [[FBSDKApplicationDelegate sharedInstance]应用程序:应用程序     openURL:url         sourceApplication:options [UIApplicationOpenURLOptionsSourceApplicationKey]         注解:选项[UIApplicationOpenURLOptionsAnnotationKey]         ];

    //在此处添加任何自定义逻辑。 退货处理 }


我当前的文件如下:

  • (BOOL)应用程序:(UIApplication *)应用程序didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@“ back”]; [[NSUserDefaults standardUserDefaults] synchronize];


当我插入代码时,它看起来像这样:

  • (BOOL)应用程序:(UIApplication *)应用程序 didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

    [[FBSDKApplicationDelegate sharedInstance]应用程序:应用程序                          didFinishLaunchingWithOptions:launchOptions];

    //在此处添加任何自定义逻辑。 返回是; }

  • (BOOL)应用程序:(UIApplication *)应用程序         openURL:(NSURL *)url         选项:(NSDictionary *)选项{

    BOOL处理= [[FBSDKApplicationDelegate sharedInstance]应用程序:应用程序                                                               openURL:url                                                     sourceApplication:options [UIApplicationOpenURLOptionsSourceApplicationKey]                                                            注解:选项[UIApplicationOpenURLOptionsAnnotationKey]                 ];

    //在此处添加任何自定义逻辑。 已处理退货;

    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@“ back”]; [[NSUserDefaults standardUserDefaults] synchronize];

Xcode告诉我 [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@“ back”]; 代码将永远不会执行。

请帮助

1 个答案:

答案 0 :(得分:0)

我的appDelegate.m看起来像theis,我没有您的错误

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

  // Firebase configurations
  [FIRApp configure];

  // Facebook SDK
  [[FBSDKApplicationDelegate sharedInstance] application:application
                           didFinishLaunchingWithOptions:launchOptions];

  NSURL *jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil];
  [ReactNativeNavigation bootstrap:jsCodeLocation launchOptions:launchOptions];

  return YES;
}



// FACEBOOK SDK
- (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;
}