FBSDKAppInvite sucessfully but can't send notification in fbaccount

余生颓废 提交于 2019-12-11 10:07:31

问题


My info.plist

FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"https://fb.me/450262455167157"];

//optionally set previewImageURL

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

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


//FBSDKAppInviteDialog delegate

-(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didCompleteWithResults:(NSDictionary *)results
{

    NSLog(@"%@",results);
}

-(void)appInviteDialog:(FBSDKAppInviteDialog *)appInviteDialog didFailWithError:(NSError *)error
{

    NSLog(@"%@",error);
}

回答1:


The applink is not your fb link which is your server php script link like,

"http://ipaddress/folder/sample.php"

Code:

 FBSDKAppInviteContent *content =[[FBSDKAppInviteContent alloc] init];
content.appLinkURL = [NSURL URLWithString:@"http://ipaddress/folder/sample.php"];
//optionally set previewImageURL
content.appInvitePreviewImageURL = [NSURL URLWithString:@"http://ipaddress/folder/image.jpg"];

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

Explanation:

1. appLinkURL- I already told this is the script from your server. appInvitePreviewImageURL - You can call the image from same server also.

The appLinkURL contains (In sample.php) Example appname = stackoverflow (here you should add your appname)

Code:

<html>
<head>
    <meta property="al:ios:url" content="stackoverflow://" />
    <meta property="al:ios:app_store_id" content="123456789" />
    <meta property="al:ios:app_name" content="stackoverflow'" />

    <meta property="al:android:url" content="stackoverflow://" />
    <meta property="al:android:app_name" content="stackoverflow" />
    <meta property="al:android:package" content="com.mycompany.couchin" />
    <meta property="al:web:url" content="http://google.com" />
</head>
<body>
    Sample App 
</body>
</html>

Explanation: al:ios:url = This is known as url schema you should add this url schema to your info.plist example below,

al:ios:app_store_id: Add appstore id, If you don't have appstore id, please add it example app already have in appstore .

al:ios:app_name: Give you appname here.

2.appInvitePreviewImageURL This image should be display from the link when you are invite your friend.



来源:https://stackoverflow.com/questions/34468728/fbsdkappinvite-sucessfully-but-cant-send-notification-in-fbaccount

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