Created
February 6, 2012 23:45
-
-
Save jagbolanos/1755953 to your computer and use it in GitHub Desktop.
Load Facebook object
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+(BOOL) loadSession { | |
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; | |
if (![defaults objectForKey:ACCESS_TOKEN_KEY] || | |
![defaults objectForKey:EXPIRATION_DATE_KEY] || | |
![defaults objectForKey:FACEBOOK_USER]) { | |
[Util clearSession]; | |
return NO; | |
} | |
Facebook *facebook = [[Util sharedInstance] facebook]; | |
facebook.accessToken = [defaults objectForKey:ACCESS_TOKEN_KEY]; | |
facebook.expirationDate = [defaults objectForKey:EXPIRATION_DATE_KEY]; | |
if (![facebook isSessionValid]) { | |
[Util clearSession]; | |
return NO; | |
} | |
[[Util sharedInstance] setUser:[defaults objectForKey:FACEBOOK_USER]]; | |
NSLog(@"%@", [[[Util sharedInstance] user] objectForKey:@"username"]); | |
return YES; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment