2012-06-03 2 views
0

이전에 addThis 및 공유 키트를 사용했지만 문제가 생겨서 지쳤습니다. 나는 마침내 페이스 북의 sdk 자료를 검토하고 작동하도록했습니다. 나 사용자가 자신의 벽에 게시 말할 수 있도록 나는 ...Facebook sdk와 사용자가 공유 한 후 메서드 호출

-(IBAction)fbPost:(id)sender 
{ 
if (![facebook isSessionValid]) { 
    NSArray *permissions = [[NSArray alloc] initWithObjects: 
          @"user_likes", 
          @"read_stream", 
          @"publish_stream", 
          nil]; 
    [facebook authorize:permissions]; 

} 


SBJSON *jsonWriter = [SBJSON new]; 

NSDictionary* actionLinks = [NSArray arrayWithObjects:[NSDictionary dictionaryWithObjectsAndKeys: 
                 @"Always Running",@"text",@"http://itsti.me/",@"href", nil], nil]; 

NSString *actionLinksStr = [jsonWriter stringWithObject:actionLinks]; 
NSDictionary* attachment = [NSDictionary dictionaryWithObjectsAndKeys: 
          @"Name", @"name", 
          @"Test Caption", @"caption", 
          @"This sure is fun", @"description", 
          @"http://www.test.com/", @"href", nil]; 
NSString *attachmentStr = [jsonWriter stringWithObject:attachment]; 
NSMutableDictionary* params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@“xxxxxxxxxx",@"app_id", 
           @"Share on Facebook", @"user_message_prompt", 
           actionLinksStr, @"action_links", 
           attachmentStr, @"attachment", 
           @"Here is the message",@"message", 
           nil]; 

AppDelegate *aDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 
[aDelegate.facebook dialog:@"stream.publish" andParams:params andDelegate:self]; 
} 

내 질문은 ... 사용자의 벽에 게시하려면이 s의 방법이되어 사용하고 있습니다? 예를 들어 "Facebook에서 공유해 주셔서 감사합니다"라는 메시지를 게시하고 싶습니다.

답변

2

내가 IOS 개발자 아니에요,하지만 FBDialogDelegate documentation에서 사용자가 dialogDidComplete 방법으로 게시했을 때 당신이 알 수있는 것 같습니다 :이 방법은 대화 후 호출

이 성공과에 관한 것입니다 이 숨겨져 있습니다. 이 메서드를 사용하여 대화 흐름의 성공 경로를 처리 할 수 ​​있습니다.

다른 방법을 사용하여 사용자가 취소했는지 또는 오류가 있는지 확인할 수도 있습니다.

대화 상자에 self을 전달하는 것처럼 보입니다. 거기에 해당 메소드를 구현하기 만하면됩니다.

+0

내가 원했던 것은 완벽했다. –

관련 문제