我的应用程序在向端点 me 的 Facebook API 发出 GET 请求时收到错误。
这是我的代码:
-(void) updateUserInformation{
FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"/me:" parameters:@{@"fields": @"id, name, email, user_birthday"}];
[request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
if(!error){
NSDictionary *userDictionary = (NSDictionary *)result;
NSMutableDictionary *userProfile = [[NSMutableDictionary alloc] initWithCapacity:8];
if (userDictionary[@"name"]) {
userProfile[@"name"] = userDictionary[@"name"];
}
if (userDictionary[@"first_name"]) {
userProfile[@"first_name"] = userDictionary[@"first_name"];
}
if (userDictionary[@"location"][@"name"]) {
userProfile[@"location"] = userDictionary[@"location"][@"name"];
}
if (userDictionary[@"gender"]) {
userProfile[@"gender"] = userDictionary[@"gender"];
}
if (userDictionary[@"birthday"]) {
userProfile[@"birthday"] = userDictionary[@"birthday"];
}
if (userDictionary[@"interested_in"]) {
userProfile[@"interested_in"] = userDictionary[@"interested_in"];
}
[[PFUser currentUser] setObject:userProfile forKey:@"profile"];
[[PFUser currentUser] saveInBackground];
}else {
NSLog(@"Error in Facebook Request %@", error);
}
}];
}
我得到的错误是:
2015-10-11 14:30:59.306 MatchedUp[2358:139193] Error in Facebook Request Error Domain=com.facebook.sdk.core Code=8 "(null)" UserInfo={com.facebook.sdk:FBSDKGraphRequestErrorGraphErrorCode=803, com.facebook.sdk:FBSDKGraphRequestErrorParsedJSONResponseKey={
body = {
error = {
code = 803;
"fbtrace_id" = "CfGbwnx4/B9";
message = "(#803) Some of the aliases you requested do not exist: me:";
type = OAuthException;
};
};
code = 404;
}, com.facebook.sdk:FBSDKGraphRequestErrorHTTPStatusCodeKey=404, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=(#803) Some of the aliases you requested do not exist: me:, com.facebook.sdk:FBSDKGraphRequestErrorCategoryKey=0}
我不是很清楚这个错误是什么意思。它说“您请求的某些别名不存在:我:”这是否意味着 completionHandler 中的结果字典不包含端点 me 的某些信息?任何帮助,将不胜感激。谢谢!
最佳答案
尝试将图形路径 @"/me:"
更改为 @"me"
。
祝你好运!
关于ios - Facebook 图 GET 请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33070359/