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;
}
[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.
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 theFBSDKApplicationDelegate
. 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
];
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With