2012-10-12 5 views
2

상태 업데이트를 게시하기 위해 iOS 6 용 SDK 3.1을 사용하고 벽면에 게시하려는 사람의 Facebook 사용자 ID가 있습니다.facebook iOS SDK 3.1에서 친구의 벽에 게시하는 방법?

"안녕하세요"라고 말하고 싶습니다. 한 사람의 벽으로. "/ [id]/feed"로 피드를 타겟팅 할 수 있지만 그래프 객체를 제공해야합니까? 어쨌든 startForPostWithGraphPath()를 사용하면됩니다.

답변

4

나는 그것을 알아 냈다!

이미 친구 ID가 없다면 FBFriendPickerDelegate를 구현하십시오. http://developers.facebook.com/docs/howtos/filter-devices-friend-selector-using-ios-sdk/

그 다음 중요한 부분은, 친구의 벽에 게시하는 방법 : 그것을 파악에

- (void)facebookViewControllerDoneWasPressed:(id)sender 
{ 
    NSString* fid; 
    NSString* fbUserName; 

    // get facebook friend's ID from selection. just gets 1 right now. 
    for (id<FBGraphUser> user in friendPickerController.selection) 
    { 
     NSLog(@"\nuser=%@\n", user); 
     fid = user.id; 

     fbUserName = user.name; 
    } 

    //Make the post. 
    NSMutableDictionary* params = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"Join me!", @"message", @"http://itunes.apple.com/my-super-app", @"link", @"My Super App", @"name", nil]; 

    NSLog(@"\nparams=%@\n", params); 

    //Post to friend's wall. 
    [FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/feed", fid] parameters:params HTTPMethod:@"POST" 
          completionHandler:^(FBRequestConnection *connection, id result, NSError *error) 
    { 
     //Tell the user that it worked. 
     UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Shared" 
                  message:[NSString stringWithFormat:@"Invited %@! error=%@", fbUserName, error] 
                  delegate:nil 
                cancelButtonTitle:@"OK" 
                otherButtonTitles:nil]; 
     [alertView show]; 
    } 
    ]; 

    //Close the friend picker. 
    [self dismissModalViewControllerAnimated:YES]; 
} 
+1

축하 - 나쁘지 곧 비활성화하는 기능이있어, https://developers.facebook.com 참조/blog/post/2012/10/10/growing-quality-apps-with-open-graph/이렇게 할 수있는 유일한 방법은 앞으로 피드 대화 상자가 될 것입니다. – CBroe

+0

정보를 제공해 주셔서 감사합니다. 친구의 벽을 대상으로하는 피드 대화 상자를 표시하는 방법을 알고 있습니까? – Curtis

+0

물론, 문서에 나와 있습니다. https://developers.facebook.com/docs/reference/dialogs/feed/ - 매개 변수 섹션. – CBroe

관련 문제