2013-05-29 4 views
0

피드 대화 상자 공유 기능을 사용하여 최신 Facebook SDK를 사용하여 Facebook에 문자 메시지를 공유하고 있습니다. 페이 스북 (Facebook)에 문자 메시지 공유가 잘 작동하지만, 공유 세션을 클릭 한 후 다시 로그인 대화 상자가 나타나면 유효한 세션 및 기록 된 사용자가 있어도 문제가 발생합니다.Facebook iOS SDK 대화 상자 공유 문제

enter image description here

- (BOOL)openSessionAllowingLoginUI:(BOOL)allowLoginUI 
{ 
NSArray *permissions = [[NSArray alloc] initWithObjects:@"offline_access",@"publish_actions",@"read_stream", nil]; 

return [FBSession openActiveSessionWithPublishPermissions:permissions 
              defaultAudience:FBSessionDefaultAudienceOnlyMe 
              allowLoginUI:YES 
             completionHandler:^(FBSession *session, FBSessionState status, NSError *error) { 

              DLog(@"Facebook Error : %@", error); 
              if (!error) { 
               [self publishPost:self.shareMessage andLink:self.shareLink]; 
              } 
             }]; 
} 


- (void)publishPost:(NSString *)message andLink:(NSString *)url 
{ 
// Put together the dialog parameters 
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys: 
           @"sample", @"name", 
           self.shareMessage, @"description", 
           self.shareLink, @"link", 
           nil]; 

[FBWebDialogs presentFeedDialogModallyWithSession:nil 
             parameters:params 
              handler: 
^(FBWebDialogResult result, NSURL *resultURL, NSError *error) { 
    if (error) { 
     // Error launching the dialog or publishing a story. 
     NSLog(@"Error publishing post."); 
    } else { 
     if (result == FBWebDialogResultDialogNotCompleted) { 
      // User clicked the "x" icon 
      NSLog(@"User canceled post publishing."); 
     } else { 
      // Handle the publish feed callback 
      NSDictionary *urlParams = [self parseURLParams:[resultURL query]]; 
      if (![urlParams valueForKey:@"post_id"]) { 
       // User clicked the Cancel button 
       NSLog(@"User canceled story publishing."); 
      } else { 

       // User clicked the Share button 
       [self displaySuccessMessage]; 
      } 
     } 
    } 
}]; 
} 
+0

정말 아무도 당신이 공유하지 않고 도울 수 있다고 생각하니? (http://mattgemmell.com/2008/12/08/what-have-you-tried/)? –

+0

코드를 의미합니까? – user1667968

+0

오 .. 물론! –

답변

0

시도

openActiveSessionWithReadPermissions:allowLoginUI:completionHandler: 

대신

openActiveSessionWithPublishPermissions:defaultAudience:allowLoginUI:completionHandler: 
를 호출

requestNewPublishPermissions:defaultAudience:completionHandler: 

다음에 전화