私は私のアプリでこれらのFacebookの権限を設定しています:
NSArray *permissions = [[NSArray alloc] initWithObjects:
@"user_games_activity",
@"friends_games_activity",
@"publish_actions",
@"user_photos",
nil];
[[myDelegate facebook] authorize:permissions];
私はそのような要求をしています:
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"name,picture",@"fields",nil];
[[delegate facebook] requestWithGraphPath:@"me" andParams:params andDelegate:self];
そして、次のような応答を処理します。
else if([request.url rangeOfString:@"me"].location != NSNotFound)
{
NSString *username = [result objectForKey:@"name"];
NSLog(@"We think the username is %@", username);
helloGreeting.text = [NSString stringWithFormat:@"Hello %@", username];
NSString *pictureUrl = [result objectForKey:@"picture"];
NSLog(@"Now loading image [%@]", pictureUrl);
NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:pictureUrl]];
profilePhoto.image = [UIImage imageWithData:data];
}
私が取得するログ出力は次のとおりです。
2012-06-26 15:10:49.002 FacebookIntegrator[10549:f803] We think the username is James Elsey
2012-06-26 15:10:49.003 FacebookIntegrator[10549:f803] Now loading image [http://profile.ak.fbcdn.net/static-ak/rsrc.php/v2/yo/r/UlIqmHJn-SK.gif]
質問:自分のプロフィール写真ではなく、デフォルトの一般的なFacebookアイコンを取得するのはなぜですか?グラフエクスプローラーで同じアクセストークンを使用して、プロフィール写真の画像のURLにアクセスできます
州の文書:user_photos
ユーザーがアップロードした写真、およびユーザーがタグ付けされた写真へのアクセスを提供します