【问题标题】:FBSDKAppInvite sucessfully but can't send notification in fbaccountFBSDK AppInvite 成功但无法在 fb 帐户中发送通知
【发布时间】:2016-03-31 20:08:41
【问题描述】:

我的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);
}

【问题讨论】:

    标签: ios objective-c facebook-invite fbsdk


    【解决方案1】:

    applink 不是你的 fb 链接,而是你的服务器 php 脚本链接,

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

    代码:

     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];
    

    解释:

    1. appLinkURL- 我已经告诉过这是来自您服务器的脚本。 appInvitePreviewImageURL - 您也可以从同一服务器调用图像。

    appLinkURL 包含(在 sample.php 中) 示例 appname = stackoverflow(您应该在此处添加您的 appname)

    代码:

    <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>
    

    说明: al:ios:url = 这称为 url 架构,您应该将此 url 架构添加到下面的 info.plist 示例中,

    al:ios:app_store_id: 添加appstore id,如果没有appstore id,请添加appstore中已有的example app。

    al:ios:app_name:在这里给你appname。

    2.appInvitePreviewImageURL 当您邀请您的朋友时,此图像应从链接中显示。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-10
      • 2020-10-11
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      • 2021-08-07
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多