Facebook 图形 API 版本 1.0 和 2.0 之间存在一些我不太喜欢的差异,因此我想降级到图形 API 版本 1.0。
有什么办法吗?
这是我现在使用的代码,它调用了 2.0 版:
[FBRequestConnection startWithGraphPath:@"/me/friends"
parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"20", @"limit", nil]
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Sucess! Include your code to handle the results here
NSLog(@"***** user friends with params: %@", result);
} else {
// An error occurred, we need to handle the error
}
}];
最佳答案
虽然上面的答案是正确的你可以使用
[FBSettings enablePlatformCompatibility: YES];
这里所有的 FbRequests 都以 api v1.0 为目标是关于这个的官方文档: https://developers.facebook.com/docs/reference/ios/current/class/FBSettings/
如果你想针对使用 v1.0 of graph api 的个人请求,你可以这样指定它:
[FBRequestConnection startWithGraphPath:@"v1.0/me/friends"
parameters:[NSDictionary dictionaryWithObjectsAndKeys:@"20", @"limit", nil]
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Sucess! Include your code to handle the results here
NSLog(@"***** user friends with params: %@", result);
} else {
// An error occurred, we need to handle the error
}
}];
这是解释这个的官方文档 https://developers.facebook.com/docs/reference/ios/current/class/FBRequest/
参见 overrideVersionPartWith: 方法及其讨论
关于ios - Facebook SDK 使用 Graph API 1.0 版,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24046105/