简体   繁体   English

iOS:获取玩应用程序的Facebook朋友

[英]IOS: Get Facebook friends who play app

I have managed to get the friendslist: 我设法获得了好友列表:

//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];

I also need need to get which friends that are playing, but get an error: 我还需要获取正在玩的朋友,但是会出现错误:

 me/friends?fields=installed


{
    error =     {
        code = 2500;
        message = "An active access token must be used to query information about the current user.";
        type = OAuthException;
    };
}

Is there a special permission I need to request for this? 我是否需要特殊许可? I use these now: 我现在使用这些:

@"read_stream", @"email", @"read_friendlists"

thanks 谢谢

you can get Fb Friend list who use App like bellow method:- 您可以获取使用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);
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM