所以,在我的应用程序中,我可以成功地共享内容。不过我有一个问题。
- 用户尚未从应用程序的任何位置登录 FB
- 用户在手机上安装了 FB 应用。
- 当我点击共享时,系统会提示我使用 safari 中的 FB 登录。
我可以跳过 no.3 吗?让用户从手机上的 FB 应用程序获取登录详细信息?
我为分享所做的一切是:
-(void) userTappedOnFBLink:(UIGestureRecognizer*)gestureRecognizer
{
NSLog(@"FB share");
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentURL = [NSURL URLWithString:SHARE_URL];
[FBSDKShareDialog showFromViewController:self.parentViewController
withContent:content
delegate:self];
}
最佳答案
如果您只想分享,为什么不使用 SLComposeViewController?是本地的,不要使用 Safari 。也适用于推特。
import Social
创建 SLComposeViewController:
if let vc = SLComposeViewController(forServiceType: SLServiceTypeFacebook) {
vc.setInitialText("Your post text") //Optional
vc.add(UIImage(named: "YourImageName")!) //Optional
vc.add(URL(string: "Your url")) //Optional
present(vc, animated: true)
}
关于IOS-FB分享打开safari对话框登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48129571/