2

ユーザー接続の場所を使用して、ユーザーがある場所でタグ付けされた投稿、ステータス、および写真を取得しようとしています。問題は、適切なアクセス許可を使用し、Graph Api Explorer で要求された結果を取得している間、同じことがアプリで発生しないことです。応答は、場所キーが欠落しているユーザー ID でのみ返されます。私が使用するコードは次のとおりです。

権限の場合:

NSArray *permissions = [[NSArray alloc] initWithObjects:@"friends_status",@"friends_photos",nil];

if (!FBSession.activeSession.isOpen) {
    // if the session is closed, then we open it here, and establish a handler for state changes
    [FBSession openActiveSessionWithReadPermissions:permissions
                                       allowLoginUI:YES
                                  completionHandler:^(FBSession *session,
                                                         FBSessionState state,
                                                         NSError *error) {
        if (error) {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                                message:error.localizedDescription
                                                               delegate:nil
                                                      cancelButtonTitle:@"OK"
                                                      otherButtonTitles:nil];
            [alertView show];
        } else if (session.isOpen) {
            [self pickFriendsButtonClick:sender];
        }
    }];
    return;
}

データを取得するには:

for (int i = 0; i < [selectedFbFriends count]; i++) {
    NSString *path = [NSString stringWithFormat:@"me/friends/%@?fields=locations",selectedFbFriends[i]];

    FBRequest *friendRequest = [FBRequest requestForGraphPath:path];
    [friendRequest startWithCompletionHandler:^(FBRequestConnection *connection, id<FBGraphObject> result, NSError *error) {

        NSLog(@"%@",result[@"data"]);
}

結果は、Graph Api Explorer で同じパスを使用した場合と同じではありません。ユーザーIDのみを取得します。何が間違っているのか分からず、許可が適切なもののように見えるので、私の頭は破裂しそうです。そこに助けがあれば大歓迎です。:)

4

1 に答える 1

0

その関数は、パラメーターをパスの一部と見なしていないようです。これを使用できます:

- (FBRequest*)requestWithGraphPath:(NSString *)graphPath
               andParams:(NSMutableDictionary *)params
               andDelegate:(id <FBRequestDelegate>)delegate;

ソース:https://developers.facebook.com/docs/reference/iossdk/request/

params は次のようになります。

NSMutableDictionary *dict = [[NSMutableDictionary alloc] init];
[dict setObject:@"locations" forKey:@"fields"];
于 2013-07-08T21:40:37.400 に答える