Error in sending app invitation in ios to facebook friends

社会主义新天地 提交于 2019-12-06 14:40:54

For facebook sdk 4.0 and later

at first create an applink.

FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL     URLWithString:@"https://www.google.com/myapplink"];
//optionally set previewImageURL 

content.appInvitePreviewImageURL = [NSURL URLWithString:@"https://www.google.com/my_invite_image.jpg"];

// present the dialog. Assumes self implements protocol `FBSDKAppInviteDialogDelegate`
[FBSDKAppInviteDialog showWithContent:content
                         delegate:self];

see this link https://developers.facebook.com/docs/app-invites/ios

EDIT:

when you create an app link and you have to provide an url scheme,this url scheme added in your project info plist.after that you add a face book canvas platform in face book developer setting page,and provide a canvas url and save it.

If you've been looking everywhere like me to figure out why it's not working, turns out Facebook is deprecating App Invites and will completely stop working as of 2/6/2018:

https://developers.facebook.com/blog/post/2017/11/07/changes-developer-offerings/

I had this error as well. What fixed it was adding

[FBSDKAppEvents activateApp];

in applicationDidBecomeActive:(UIApplication *)application

within the appDelegate. See also https://developers.facebook.com/docs/app-events/ios#appActivation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!