Note that there are some explanatory texts on larger screens.

plurals
  1. POfacebook iphone sdk logout issue!
    primarykey
    data
    text
    <p>Ive been searching for solution to what seems to be a simple problem for a while now but have had no luck. The login code is as follows.</p> <pre><code>- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url { return [facebook handleOpenURL:url]; } - (void)applicationDidBecomeActive:(UIApplication *)application { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; NSString *accessToken = [prefs stringForKey:@"facebook-accessToken"]; NSDate *expirationDate = [prefs objectForKey:@"facebook-expirationDate"]; facebook.accessToken = accessToken; facebook.expirationDate = expirationDate; if ([facebook isSessionValid]) { NSLog(@"valid session"); } else { NSLog(@"NOT VALID"); [facebook authorize:nil delegate:self]; } } - (void)fbDidLogin { NSLog(@"delegate method"); NSString *accessToken = facebook.accessToken; NSDate *expirationDate = facebook.expirationDate; NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; [prefs setObject:accessToken forKey:@"facebook-accessToken"]; [prefs setObject:expirationDate forKey:@"facebook-expirationDate"]; [prefs synchronize]; } </code></pre> <p>I have a property of Type Facebook in my rootViewController and a button to logout. I pass the facebook instance to the rootViewController and then try to log out as follows.</p> <pre><code>-(IBAction) logout { [facebook logout:self]; } - (void)fbDidLogout { NSUserDefaults *prefs = [NSUserDefaults standardUserDefaults]; [prefs setObject:nil forKey:@"facebook-accessToken"]; [prefs setObject:nil forKey:@"facebook-expirationDate"]; [prefs synchronize]; } </code></pre> <p>It kind of works..... Eg. When I do not log out I can restart the app even after closing it down properly (holding icon then pressing x) and the user will be logged in without having to do anything. But when I log out, the next time the app is started the user doesnt get a chance to re-enter the login details, instead I just get a facebook page saying "you have already authorised this app to use facebook"?? </p> <p>Does anyone know if I am going about this the wrong way as its really annoying me now?</p> <p>Many thanks</p> <p>Jules</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload