次のコードを使用して Facebook リクエスト メソッドを呼び出しています。このリクエストは、'data' というラベルの付いたキーを持つ NSDictionary オブジェクトを返すデリゲート メソッドを呼び出します。次に、 NSArray *data = [result objectForKey:@"data"];を呼び出して、友人の配列を取得します。
次に、コードはその配列をループし、名前を抽出してコンソールに出力します。
私が抱えている問題は、この配列を、ユーザーが友人を選択して FB ウォールに投稿できるテーブルに送信する方法です。
助けてくれてありがとう:)
AppDelegate *delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[[delegate facebook] requestWithGraphPath:@"me/friends" andDelegate:self];
// get the array of friends
NSArray *data = [result objectForKey:@"data"];
NSMutableArray *array = [NSMutableArray array];
for (int i = 0; i < data.count; i++){
id object = [data objectAtIndex:i];
[array addObject:[object objectForKey:@"name"]];
}
// output the array of friends
NSLog(@"list of friends %@", array);
私は次のようなものが必要だと考えています ( objectAtIndex:?????の部分に何を入れればよいかわかりません:
[self apiDialogFeedFriend:[[data objectAtIndex:**?????**] objectForKey:@"id"]];
その後
[self apiGraphFriends];