Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I had the same problem and have a lot of time lost and find no solution but a workaround.</p> <p>I have three methods</p> <pre><code>- (void) openMyFacebook - (void) fbDidLogin - (void) dialogFacebook </code></pre> <p>I call openMyFacebook</p> <p>in <code>- (void) openMyFacebook,</code> I alloc Facebook and look if there are already stored keys in NSUserDefaults if not I call <code>[facebook authorize:nil delegate:self];</code> in the delegate <code>- (void) fbDidLogin</code> I Store the Keys (same in the facbook example). Then comes the trick.</p> <p>Release facebook </p> <pre><code>[facebook release]; facebook = nil; </code></pre> <p>and start the <code>- (void) openMyFacebook</code> again with the stored keys.</p> <p>Works perfect.</p> <pre><code>- (void) openMyFacebook { if (facebook == nil) { facebook = [[Facebook alloc] initWithAppId:@"xxxxxxxxxx"]; } NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey:@"FBAccessTokenKey"] &amp;&amp; [defaults objectForKey:@"FBExpirationDateKey"]) { facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"]; facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"]; } if (![facebook isSessionValid]) { [facebook authorize:nil delegate:self]; } else { [self dialogFacebook]; } } - (void)fbDidLogin { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; [defaults setObject:[facebook accessToken] forKey:@"FBAccessTokenKey"]; [defaults setObject:[facebook expirationDate] forKey:@"FBExpirationDateKey"]; [defaults synchronize]; //release!!!! [facebook release]; facebook = nil; //and start again [self openMyFacebook]; } - (void) dialogFacebook { NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys: kAppId, @"app_id", linkextern, @"link", facebookImageUrlString, @"picture", name, @"name", @" ", @"message", nil]; [facebook dialog:@"feed" andParams:params andDelegate:self]; } </code></pre>
 

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