UIActivityViewController for Facebook未显示默认文本 [英] UIActivityViewController for Facebook not Showing Default Text

查看:120
本文介绍了UIActivityViewController for Facebook未显示默认文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一个提供一些默认文本和链接的UIActivityViewController。使用所有社交媒体(短信,电子邮件,twitter)显示默认文字和网址。但是,当FB显示URL图像时,默认文本不显示(只是空白)。以下是代码:

I am using a UIActivityViewController which provides some default text and a link. With all social mediums (sms, email, twitter) the default text and URL are shown. However, with FB while the URL image is shown, the default text is not showing (it is just blank). Below is the code:

    NSString *shareStr = [NSString stringWithFormat:@""some text"];
    NSURL *website = [NSURL URLWithString:@"website"];
    NSArray *shareAray = @[shareStr,website];

    [self viewWillDisappear:YES];

    UIActivityViewController *activityController = [[UIActivityViewController alloc]initWithActivityItems:shareAray
                                                                                    applicationActivities:nil];

    if([activityController respondsToSelector:@selector(popoverPresentationController)] )
        activityController.popoverPresentationController.barButtonItem = self.shareButton;


    [self presentViewController:activityController
                       animated:YES completion:nil];

    [activityController setCompletionHandler:^(NSString *activityType, BOOL completed){
        if (!activityType || UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
        {
            [self viewWillAppear:YES];
        }
    }];

更新:
如下面其他人所说,FB不再允许预填。这是一个视频的另一个链接,其中列出了允许的内容以及没有的内容: https://开发人员。 facebook.com/docs/apps/review/prefill

推荐答案

似乎Facebook不再希望开发者预先用文字填写文章。从 https://developers.facebook.com/docs/sharing/ios#ios-integration

It would seem Facebook no longer wants developers to pre-fill posts with text. From https://developers.facebook.com/docs/sharing/ios#ios-integration:


iOS分享表的使用受Facebook平台政策的约束,其中包括2.3节,其中规定应用程序可能不会预先填写。在分享表格的上下文中,这意味着应用程序可能不会预先填写共享表的initialText字段,其中包含用户之前未使用该应用程序未输入的内容。

Use of the iOS share sheet is subject to Facebook Platform Policy, including section 2.3 which states that apps may not pre-fill. In the context of the share sheet, this means apps may not pre-fill the share sheet's initialText field with content that wasn't entered by people earlier in their use of the app.

似乎他们更喜欢开发人员使用SDK:

Seems they would prefer devs to use the SDK:


虽然可以使用iOS本机直接查看控制器API(共享表),有几个原因可以使用Facebook SDK提供的本机iOS共享对话框。使用本机共享对话框提供了一种快速的方式来测试人们已经在iOS 6+设备上登录到Facebook。该API还使用与Facebook SDK其他部分相同的样式块。

While you can use the iOS native view controller API (share sheet) directly, there are several reasons to use the native iOS Share dialog provided by the Facebook SDK. Using the native Share dialog provides a quick way to test that people have signed into Facebook on their iOS 6+ devices. This API also uses the same style block as other parts of the Facebook SDK.

这篇关于UIActivityViewController for Facebook未显示默认文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆