How to keep Facebook Session Alive

The key is set up the AppDelegate file correctly.

This discussion on stackoverflow offers a simple and clean sample.

http://stackoverflow.com/questions/15699131/ios-loses-fbsession-when-closing-app

(the sample appDelegeate inside is correct, the user has an error because he made repetitive calls to openSessionWithAllowLoginUI)

The important part is call


[self openSessionWithAllowLoginUI:YES];

in


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

Additionally, In


- (void)applicationWillTerminate:(UIApplication *)application {...}

Make sure you have


//[FBSession.activeSession close];

comment out.

Advertisements
This entry was posted in Facebook API, IPhone App Development. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s