首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SLComposeViewController将崩溃

SLComposeViewController将崩溃
EN

Stack Overflow用户
提问于 2017-04-06 11:24:28
回答 1查看 89关注 0票数 0

一个奇怪的bug,我用下面的代码在facebook上分享了一些

代码语言:javascript
复制
if ([SLComposeViewController isAvailableForServiceType:SLServiceTypeFacebook]) {
SLComposeViewController *slComposeViewController = [SLComposeViewController composeViewControllerForServiceType:SLServiceTypeFacebook];

[slComposeViewController setInitialText:@"text"];
[slComposeViewController addImage:[UIImage imageNamed:@"image"]];
[self presentViewController:slComposeViewController animated:YES completion:nil];
} else {
 NSLog(@"Facebook not available");
}

如果在ios设置下没有facebook帐户,也没有facebook应用程序,上面的代码将运行良好,显示日志'Facebook不可用‘,但如果在ios设置下没有facebook帐户,并且有facebook应用程序,以上代码将崩溃。还有别的办法吗?

EN

回答 1

Stack Overflow用户

发布于 2017-04-06 14:30:51

您可以使用FBSDK。here is the tutorial link

代码语言:javascript
复制
let content = FBSDKShareLinkContent()
            content.contentURL = NSURL(string: "http://share.html?id=\(1)&type=0")

            content.contentDescription = "here goes your description"



            content.imageURL = NSURL(string: "\(API_BASE_URL)\(primaryImagepath)")


            dialog.shareContent = content
            if  dialog.canShow() {
                dialog.show()
            }else{
                dialog.mode = .FeedBrowser
                dialog.show()
            }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43245120

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档