我正在使用社交框架来实现Facebook,我可以通过社交框架登录到facebook,但是当试图获取朋友列表然后返回空列表。下面是我用来获取朋友列表的代码。
SLRequest *friendsListRequest = [SLRequest requestForServiceType:SLServiceTypeFacebook
requestMethod:SLRequestMethodGET
URL:URLIFY(@"https://graph.facebook.com/me/friends")
parameters:nil];
friendsListRequest.account = facebookAccount;
[friendsListRequest performRequestWithHandler:^(NSData *responseData, NSHTTPURLResponse *urlResponse, NSError *error) {
if (responseData) {
NSLog(@"Got a response: %@", [[NSString alloc] initWithData:responseData
encoding:NSUTF8StringEncoding]);
if (urlResponse.statusCode >= 200 && urlResponse.statusCode < 300) {
NSError *jsonError = nil;
NSDictionary *friendsListData = [NSJSONSerialization JSONObjectWithData:responseData
options:NSJSONReadingAllowFragments
error:&jsonError];
if (jsonError) {
NSLog(@"Error parsing friends list: %@", jsonError);
} else {
self.friendsList = friendsListData[@"data"];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
}
} else {
NSLog(@"HTTP %d returned", urlResponse.statusCode);
}
} else {
NSLog(@"ERROR Connecting");
}
我来这里
Got a response: {"data":[]}
Printing description of friendsListData:
{
data = (
);
}
不知道丢失的是什么,它不会从我的帐户返回朋友列表。
请帮忙。提前致谢