FBSDKAppInviteDialog,离开时重启应用程序

时间:2023-01-16 16:10:40

I'm inviting friends to use the application through the FBSDKAppInviteDialog provided by the Facebook SDK.

我邀请朋友通过Facebook SDK提供的FBSDKAppInviteDialog来使用该应用程序。

let inviteDialog:FBSDKAppInviteDialog = FBSDKAppInviteDialog()
    if(inviteDialog.canShow()){
        let content = FBSDKAppInviteContent()
        content.appLinkURL = NSURL(string: "xxxxxxxx")
        content.appInvitePreviewImageURL = NSURL(string: "xxx")
        inviteDialog.delegate = self
        inviteDialog.fromViewController = self
        inviteDialog.content = content
        inviteDialog.show()
    }

And the delegate methods:

和委托方法:

extension InviteFriendsEmailViewController: FBSDKAppInviteDialogDelegate{
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didCompleteWithResults results: [NSObject : AnyObject]!) {
}
func appInviteDialog(appInviteDialog: FBSDKAppInviteDialog!, didFailWithError error: NSError!) {
}}

Everything is working properly except that when the invitations are sent (successfully), I'm redirected at the initial UIViewController of my storyboard.. I don't know why. Like if the application was restarting.

一切正常,除了当邀请被发送(成功)时,我被重定向到我的故事板的初始UIViewController ......我不知道为什么。就像应用程序重新启动一样。

Is there someone that could help me?

有人可以帮助我吗?

Thank you by advance ! Ben

提前谢谢你!本

1 个解决方案

#1


0  

Actually the problem was that when you are leaving the FBSDKAppInviteDialog, you're entering the AppDelegate function :

实际上问题是当你离开FBSDKAppInviteDialog时,你正在进入AppDelegate函数:

 func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {

And in this function I was parsing some dynamic links and opening some other UIViewControllers !

在这个函数中,我正在解析一些动态链接并打开其他一些UIViewControllers!

Hope this will help someone ^^

希望这会帮助某人^^

Bye !

#1


0  

Actually the problem was that when you are leaving the FBSDKAppInviteDialog, you're entering the AppDelegate function :

实际上问题是当你离开FBSDKAppInviteDialog时,你正在进入AppDelegate函数:

 func application(app: UIApplication, openURL url: NSURL, options: [String : AnyObject]) -> Bool {

And in this function I was parsing some dynamic links and opening some other UIViewControllers !

在这个函数中,我正在解析一些动态链接并打开其他一些UIViewControllers!

Hope this will help someone ^^

希望这会帮助某人^^

Bye !