在 [self.facebook requestWithGraphPath:@"me" andDelegate:self]; 我得到了上面提到的异常。这是我的代码
- (void)viewDidLoad
{
[super viewDidLoad];
self.facebook = [[Facebook alloc] initWithAppId:@"<app id hidden>" andDelegate:self];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"FBAccessTokenKey"]
&& [defaults objectForKey:@"FBExpirationDateKey"]) {
self.facebook.accessToken = [defaults objectForKey:@"FBAccessTokenKey"];
self.facebook.expirationDate = [defaults objectForKey:@"FBExpirationDateKey"];
}
if (![self.facebook isSessionValid]) {
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_likes",
@"read_mailbox",
nil];
[self.facebook authorize:permissions];
[self.facebook requestWithGraphPath:@"me" andDelegate:self];
}
}
- (BOOL)application:(UIApplication *)application openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
return [self.facebook handleOpenURL:url];
}
- (void)fbDidLogin {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:[self.facebook accessToken] forKey:@"FBAccessTokenKey"];
[defaults setObject:[self.facebook expirationDate] forKey:@"FBExpirationDateKey"];
[defaults synchronize];
}
-(void)request:(FBRequest *)request didLoad:(id)result
{
NSArray *messagesResult= result;
}
-(void) request:(FBRequest *)request didFailWithError:(NSError *)error
{
NSLog(@"%@",error);
}