我想弄清楚這個錯誤的含義是什麼...iPhone Facebook SDK錯誤
我想通過Facebook SDK獲取用戶信息。所有我需要的是他們的電子郵件和姓名
Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0xde94ad0 {error=<CFBasicHash 0xde7d100 [0x3f616650]>{type = mutable dict, count = 3,
entries =>
2 : <CFString 0xde722a0 [0x3f616650]>{contents = "type"} = <CFString 0xdeba1a0 [0x3f616650]>{contents = "OAuthException"}
3 : <CFString 0xde6ba20 [0x3f616650]>{contents = "message"} = <CFString 0xdeb12a0 [0x3f616650]>{contents = "An active access token must be used to query information about the current user."}
6 : <CFString 0xde74c40 [0x3f616650]>{contents = "code"} = 2500
}
}
我(在我的viewDidLoad以下)基本代碼...
facebook = [[Facebook alloc] initWithAppId:@"random#123456" andDelegate:self];
[self login];
(下面我登錄方法)
- (void) login {
NSArray *permissionsArray = [NSArray arrayWithObjects:@"email", nil];
[facebook authorize:permissionsArray];
}
(和我的Facebook請求方法...)
- (void)request:(FBRequest *)request didLoad:(id)result {
NSLog(@"Inside didLoad");
if ([result isKindOfClass:[NSArray class]]) {
result = [result objectAtIndex:0];
}
// When we ask for user infor this will happen.
if ([result isKindOfClass:[NSDictionary class]]){
//NSDictionary *hash = result;
NSLog(@"Name: %@", [result objectForKey:@"name"]);
}
if ([result isKindOfClass:[NSData class]])
{
NSLog(@"Profile Picture");
//[profilePicture release];
//profilePicture = [[UIImage alloc] initWithData: result];
}
NSLog(@"request returns %@",result);
//if ([result objectForKey:@"owner"]) {}
};
- (void)request:(FBRequest *)request didFailWithError:(NSError *)error{
NSLog(@"%@",error);
}
我真的很困惑,爲什麼我得到一個錯誤,我需要更改或添加以修復它...
任何想法?
編輯:我的請求代碼:::
- (IBAction)requestFBFriends:(id)sender {
NSLog(@"HERE");
[facebook requestWithGraphPath:@"me/friends" andDelegate:self];
}
我不知道有關的權限驗證你正在使用,但在我的應用程序中,我使用「電子郵件」作爲唯一的權限,這使您可以訪問聯繫人電子郵件,名稱是一個基本的權限,所以你不需要指定它 – Moxy 2012-07-21 13:06:25
@Moxy我改變了我的權限只有電子郵件,我仍然得到相同的錯誤... – 2012-07-21 13:08:12
請問您可以添加您的請求代碼,還可以在哪裏調用它? – Moxy 2012-07-21 13:57:28