2012-09-29 14 views
6

oturum açtıktan sonra çağrılmadı openActiveSessionWithPublishPermissions kullanarak Facebook'ta yayınlamaya çalışıyorum, bu yüzden eğer kullanıcı oturum açmadıysa önce oturum açmalı ve ardından io6 Facebook native Dialog'u kullanarak mesaj göndermelidir.Facebook ios6 completionHandler,

Ne bulduğum giriş yapamıyorum, ancak tamamlama işleyicisi çağrılmadı.

ben tekrar giriş butonu tıklandığında o zaman FBSessionStateClosedLoginFailed aşağıdaki hata ile tamamlanması işleyicisi çağırır, fark başka şey.

this post'a başvurdum ama yine de sorunuma bir çözüm bulamadı.

NSArray *permissions = [NSArray arrayWithObjects:@"publish_stream", nil]; 
[FBSession openActiveSessionWithPublishPermissions:permissions defaultAudience:FBSessionDefaultAudienceEveryone allowLoginUI:YES completionHandler: 
^(FBSession *session, FBSessionState status, NSError *error) 
{ 

    switch (status) { 

        case FBSessionStateOpen: 
         { 
          [FBNativeDialogs presentShareDialogModallyFrom:currentController initialText:nil image:nil url:nil handler:^(FBNativeDialogResult result, NSError *error) {}]; 
         } 
         break; 
        default: 
         break; 
        } 
       }]; 

cevap

0

Bunu eklemek zorunda olmalıdır:

[FBNativeDialogs presentShareDialogModallyFrom:currentController initialText:nil 
    image:nil url:nil handler:^(FBNativeDialogResult result, NSError *error) { 
    if (result==FBNativeDialogResultCancelled) { 
    UIAlertView  *alert=[[UIAlertView alloc]initWithTitle:@"Error" 
     message:@"Sending Cancelled" delegate:self cancelButtonTitle:@"OK" 
     otherButtonTitles: nil]; 
    [alert show]; 
} else if (result==FBNativeDialogResultSucceeded) { 
    UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"Succeed" 
    message:@"succeed" delegate:self cancelButtonTitle:@"OK" 
    otherButtonTitles: nil]; 
    [alert show]; 
}***}***]; 
5

Eğer handleOpenUrl yöntemini uygulamaya dikkat edin.

-(BOOL)application:(UIApplication *)application 
      openURL:(NSURL *)url 
sourceApplication:(NSString *)sourceApplication 
     annotation:(id)annotation { 

    return [[FBSession activeSession] handleOpenURL:url]; 

} 
+0

Bu işlem bitti, bu kodu zaten eklemiştim. – andyPaul