我目前有以下代碼,選擇一個隨機的Facebook朋友,並張貼到他們的牆上。我希望能夠從所有朋友中選擇(而不是隨機選擇一個)併發布到他們的牆上。如果有人能幫助我用下面的代碼,這將是巨大的:)發佈到Facebook的朋友牆而不是發送與iOS的通知
case gkAPIFriendsForDialogFeed:
{
NSArray *resultData = [result objectForKey: @"data"];
// Check that the user has friends
if ([resultData count] > 0) {
// Pick a random friend to post the feed to
int randomNumber = arc4random() % [resultData count];
[self apiDialogFeedFriend:
[[resultData objectAtIndex: randomNumber] objectForKey: @"id"]];
} else {
[self showMessage:@"You do not have any friends to post to."];
}
break;
}
這個代碼選擇了所有的朋友,但不張貼到他們的牆上,而不是它發送一些通知:
case gkAPIGetAppUsersFriendsUsing:
{
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]];
}
if ([friendsWithApp count] > 0) {
[self apiDialogRequestsSendToUsers:friendsWithApp];
} else {
[self showMessage:@"None of your friends are using Whatto."];
}
[friendsWithApp release];
break;
}
是不是有一種方法來改變它,而不是挑選一個隨機的朋友它顯示所有?謝謝 – hanumanDev 2012-07-23 12:31:50
我會爲ObjectAtIndex的tag.tag放入什麼?我需要用戶能夠從朋友列表中選擇一個朋友。謝謝 :) – hanumanDev 2012-07-25 10:31:37