I am using the facebook-ios-sdk. I am basically getting facebook from the appDelegate and everytime It hits my viewController it calls this method:
- (void)openFacebook{
appDelegate.facebook = [[Facebook alloc] initWithAppId:@"11234567892515" andDelegate:self];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
appDelegate.facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
appDelegate.facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![appDelegate.facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_likes",
@"read_stream",
@"user_photos",
//@"user_about_me",
//@"email",
@"publish_stream",
@"publish_actions",
nil];
[appDelegate.facebook authorize:permissions];
NSLog(@"Facebook session is valid");
[appDelegate.facebook extendAccessTokenIfNeeded];
}
}
The problem is…. even if the app is allowed it still comes up with dialog to allow the application…
How can I stop it from popping up everytime asking me to authorize the app even though I hav e already authorized it? Please keep it simple I am no genius thanks :).
My guess would be that you aren’t storing the AccessToken and ExpiryDate once you’ve logged in.
Add this to see if you have these stores in UserDefaults
In your Facebook fbDidLogin method do you have like this?