简体   繁体   English

iOS Native Facebook不共享互联网回调

[英]iOS Native Facebook Share no internet callback

I'm trying to implement the native facebook share for iOS 6 and need check if a share did succeed or not. 我正在尝试为iOS 6实现本机Facebook共享,并且需要检查共享是否成功。 This is the code I have used: 这是我使用的代码:

BOOL displayedNativeDialog =
    [FBNativeDialogs
     presentShareDialogModallyFrom:delegate
     initialText:@"test"
     image:nil
     url:nil
     handler:^(FBNativeDialogResult result, NSError *error) {
         if (error) {
             /* handle failure */
             NSLog(@"error:%@, %@", error, [error localizedDescription]);
         } else {
             if (result == FBNativeDialogResultSucceeded) {
                 /* handle success */
                 NSLog(@"handle success");
             } else {
                 /* handle user cancel */
                 NSLog(@"user cancel");
             }
         }
     }];
    if (!displayedNativeDialog) {
        /* handle fallback to native dialog  */
    }

My problem is when I try this with no internet connection available I still get the FBNativeDialogResultSucceeded 我的问题是,当我尝试此操作而没有可用的互联网连接时,我仍然得到FBNativeDialogResultSucceeded

It looks like you should get an error when no internet connection is available but it seems that it doesn't work like that. 当没有可用的互联网连接时,您似乎应该得到一个错误,但似乎无法正常工作。 If there are some solution where I don't need to use the reachability SDK that would be great. 如果有不需要我使用可达性SDK的解决方案,那就太好了。

You'll likely have to use the reachability SDK at this point. 此时,您可能必须使用可达性SDK。 The Facebook SDK builds on top of the SLComposeViewController for the native functionality. Facebook SDK基于SLComposeViewController的本机功能构建。 That view controller returns two possible choices: 该视图控制器返回两个可能的选择:

  • SLComposeViewControllerResultCancelled SLComposeViewControllerResultCancelled
  • SLComposeViewControllerResultDone SLComposeViewControllerResultDone

SLComposeViewControllerResultDone: The view controller is dismissed and the message is being sent in the background. SLComposeViewControllerResultDone:关闭视图控制器,并且在后台发送消息。 This occurs when the user selects Done. 当用户选择“完成”时,会发生这种情况。

So since Facebook mirrors this the success case means the user clicked done and the message has been sent in the background. 因此,由于Facebook反映了这一点,因此成功案例意味着用户单击“完成”,并且消息已在后台发送。

However if you run this and there is no internet connection, the user should still see a pop-up indicating that the post could not be sent due to a connection failure. 但是,如果运行此命令并且没有Internet连接,则用户仍应看到一个弹出窗口,指示由于连接失败而无法发送该帖子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM