我设法得到了朋友列表:
//token
NSString *acessToken = [NSString stringWithFormat:@"%@",_facebookAccount.credential.oauthToken];
NSDictionary *parameters = @{@"access_token": acessToken};
// Create the URL to the end point
NSURL *friendsList = [NSURL URLWithString:@"https://graph.facebook.com/me/friends"];
// Create the SLReqeust
SLRequest *getFriends = [SLRequest requestForServiceType:SLServiceTypeFacebook requestMethod:SLRequestMethodGET URL:friendsList parameters:parameters];
我还需要获取正在播放的朋友,但收到错误:
me/friends?fields=installed
{
error = {
code = 2500;
message = "An active access token must be used to query information about the current user.";
type = OAuthException;
};
}
我需要特殊许可吗?我现在用这些:
@"read_stream", @"email", @"read_friendlists"
感谢
答案 0 :(得分:1)
你可以获得使用App的Fb Friend列表,如下方法: -
- (void)apiRESTGetAppUsers {
//[self apiGraphFriends];
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
@"friends.getAppUsers", @"method",
nil];
[[objapp facebook] requestWithParams:params
andDelegate:self];
}
- (void)request:(FBRequest *)request didLoad:(id)result {
NSMutableArray *friendsWithApp = [[NSMutableArray alloc] initWithCapacity:1];
// Many results
if ([result isKindOfClass:[NSArray class]]) {
[friendsWithApp addObjectsFromArray:result];
} else if ([result isKindOfClass:[NSDecimalNumber class]]) {
[friendsWithApp addObject: [result stringValue]];
}
NSLog(@"Array of all userfrnd of faceboolk == %@",friendsWithApp);
}