Grab FBConnect sources from FBConnect Github repository, fix the demo to work for you (instrunction how to do that were long, but excellent) - and then add these modifications in DemoAppViewController.m:
- (void)fbDidLogin
{
[[NSUserDefaults standardUserDefaults] setObject:self.facebook.accessToken forKey:@"FBAccessToken"];
[[NSUserDefaults standardUserDefaults] setObject:self.facebook.expirationDate forKey:@"FBExpirationDate"];
}
- (void)viewDidLoad
{
self.facebook.accessToken = [[NSUserDefaults standardUserDefaults] stringForKey:@"FBAccessToken"];
self.facebook.expirationDate = (NSDate *) [[NSUserDefaults standardUserDefaults] objectForKey:@"FBExpirationDate"];
if ([self.facebook isSessionValid] == NO)
[self.facebook authorize:_permissions delegate:self];
else
[self fbDidLogin];
}
- (void)fbDidLogoutRemember this is NOT all the code you need, just what was needed to add in my case. Your FBConnect demo application might differ. Also note that I had turned "Single Sing-On" off, no idea how this code would work when it's enabled. Will worry about that later, if needed by the "real application".
{
[[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"FBAccessToken"];
[[NSUserDefaults standardUserDefaults] setObject:@"" forKey:@"FBExpirationDate"];
}
No comments:
Post a Comment