如何在共享链接通过信使共享对话框后摆脱回到Messenger

时间:2016-08-13 09:48:25

标签: ios swift xcode

目前,我的代码是打开共享对话框以通过信使共享链接:

let invitationLink = NSURL(string:"http://somelink.com")

        if (UIApplication.sharedApplication().canOpenURL(NSURL(string: "fb-messenger-api://")!)){

            let share  = FBSDKMessageDialog()

            share.shareContent = FBSDKShareLinkContent()

            share.delegate = self
            share.shareContent.contentURL = invitationLink

            share.show()
        }[![enter image description here][1]][1]

我正在通过我的视图控制器上的FBSDKSharingDelegate处理响应

通过这样做,应用程序打开Messenger,似乎当信使共享完成或取消时,我仍然有“返回信使”,就像Messenger应用程序是创始人...我本来希望不会看到关闭共享对话框后“返回Messenger”按钮..有什么想法吗?

提前致谢,

1 个答案:

答案 0 :(得分:0)

尝试将此行添加到AppDelegate

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool
{
    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
    return true
}