1

我设法获得了朋友列表:

//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"

谢谢

4

1 回答 1

1

您可以通过以下方法获取使用 App 的 Fb 好友列表:-

- (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);
}
于 2013-03-11T07:25:47.393 回答