Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Facebook SDK ios v4.4.0 didFinishLaunchingWithOptions

I have implemented Facebook SDK in my iOS app following the Facebook guidelines and in my AppDelegate I set:

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

  return [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
}

Now, I have also implemented handoff in my app and - (BOOL) application:(UIApplication *)application willContinueUserActivityWithType:(NSString *)userActivityType will never be called when app starts from scratch because FBSDKApplicationDelegate sharedInstance returns false.

So my question: Is there any side effects if I don't return the result of [FBSDKApplicationDelegate sharedInstance]application:didFinishLaunchingWithOptions and I return my custom result? For example:

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

  [[FBSDKApplicationDelegate sharedInstance] application:application didFinishLaunchingWithOptions:launchOptions];
  return YES;
}
like image 424
agy Avatar asked Oct 20 '22 06:10

agy


1 Answers

Short answer NO.


[FBSDKApplicationDelegate application: didFinishLaunchingWithOptions:] method should be invoked just for the proper use of the Facebook SDK from the [UIApplicationDelegate application:didFinishLaunchingWithOptions:] method of the AppDelegate for your app.

This method return YES if the url was intended for the Facebook SDK, NO if not.


In latest Facebook getting started docs they mention it

To post process the results from Facebook Login or Facebook Dialogs (or any action that requires switching over to the native Facebook app or Safari) you need to conenct your AppDelegate to the FBSDKApplicationDelegate. In your AppDelegate.m add:

//  AppDelegate.m
#import <FBSDKCoreKit/FBSDKCoreKit.h>

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  [[FBSDKApplicationDelegate sharedInstance] application:application
    didFinishLaunchingWithOptions:launchOptions];
  return YES;
}

- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance] application:application
    openURL:url
    sourceApplication:sourceApplication
    annotation:annotation
  ];
}
like image 54
Vineet Choudhary Avatar answered Oct 31 '22 02:10

Vineet Choudhary