아래의 Facebook Hackbook 샘플 코드를 앱에서 사용하고 있습니다. 방법 는이 방법 줄 그러나iOS 앱에서 Facebook 친구의 벽 선택 및 게시
/*
* Helper method to first get the user's friends then
* pick one friend and post on their wall.
*/
- (void)getFriendsCallAPIDialogFeed {
// Call the friends API first, then set up for targeted Feed Dialog
currentAPICall = kAPIFriendsForDialogFeed;
[self apiGraphFriends];
}
"GET 그들이 하나를 선택하고 자신의 벽에 게시 할 수 있도록 사용자의 친구이다"고 (코멘트에서)라고 getFriendsCallAPIDialogFeed currentAPICall = kAPIFriendsForDialogFeed; 아래의 요청 방법을 호출 한 다음 kAPIFriendsForDialogFeed을 호출합니다.
내가 겪고있는 문제는 사용자의 친구를 임의로 선택한다는 것입니다. 대신 사용자가 원하는 친구를 선택할 수 있어야합니다. 어떤 도움
- (void)request:(FBRequest *)request didLoad:(id)result {
[self hideActivityIndicator];
if ([result isKindOfClass:[NSArray class]] && ([result count] > 0)) {
result = [result objectAtIndex:0];
}
switch (currentAPICall) {
case kAPIFriendsForDialogFeed:
{
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 kAPIGetAppUsersFriendsUsing:
{
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;
}
:
이 SO 질문은 어떻게 친구의 벽에 게시하는 방법을 설명합니다. .. 나는 Facebook API를 사용하지 않지만, 벽 포스트 – Dustin
이 정확한지, 코멘트가 "Helper 메소드가 먼저 사용자의 친구를 사귀고 친구의 한 명을 벽에 올리면 . " 친구가 임의로 선택합니다. – hanumanDev
벽 게시 코드가 포함 된 질문에 대한 링크로 답변을 업데이트했습니다. – Dustin