I want an iOS app to switch between a number of Facebook apps during runtime.
I want the user to be able to login and post under different Facebook App IDs depending which part of the iOS app they are using.
The Facebook iOS SDK reads Facebook AppID from the .plist file. Is it possible to change the AppID during runtime and have the user effectively logged into multiple Facebook App at the same time?
FBSession
has an initializer that can be used to specify an AppID.
FBSession *session = [[FBSession alloc] initWithAppID:@"AN_APP_ID"
permissions:nil
defaultAudience:FBSessionDefaultAudienceNone
urlSchemeSuffix:nil
tokenCacheStrategy:nil];
[session openWithCompletionHandler:^(FBSession *session, FBSessionState status, NSError *error) {
// do stuff here
}];
So you can instantiate several FBSession
s and use them in different parts of the app.
You just have to change the active session to switch from an app to another
[FBSession setActiveSession:mySession];
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