3
使用FBSDKLoginKit,FBSDKShareKit登录,共享链接和我的应用程序中的链接时出现此错误。我用FBSDKLoginButton登录使用Facebook SDK在iOS 10上登录,共享和使用Facebook SDK时获取空白页4.15.1
@property (nonatomic, strong) IBOutlet FBSDKLoginButton *loginButton;
- (void)viewDidLoad {
[super viewDidLoad];
self.loginButton.publishPermissions = @[@"publish_actions"];
}
使用FBSDKShareKit分享 :
- (FBSDKShareDialog *)getShareDialogWithContentURL:(FBSDKShareLinkContent *)content
{
FBSDKShareDialog *shareDialog = [[FBSDKShareDialog alloc] init];
shareDialog.shareContent = content;
return shareDialog;
}
- (IBAction)ShareAppOnFB:(UIButton *)sender {
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
FBSDKShareDialog *facebookShareDialog = [self getShareDialogWithContentURL:content];
if ([facebookShareDialog canShow]) {
[FBSDKShareDialog showFromViewController:self.parentViewController
withContent:content
delegate:self];
}
}
使用FBSDKShareKit喜欢:
FBSDKLikeButton *like = [[FBSDKLikeButton alloc] init];
like.objectID = @"";
like.frame = CGRectOffset(like.frame, 50, 100);
[self.view addSubview:like];
一切工作正常iOS上的9和iOS 8,但是当我升级到Xcode 8并在iOS 10上运行,当点击登录,共享和类似按钮时,我立即得到一个空白页面,之后什么也没有发生。我试图升级到Facebook SDK 4.15.1,但没有更好的,这个错误仍然发生。任何人都知道如何解决iOS 10上的这个错误?
创建一个新的UIWindow实例非常激进。您应该构建应用程序,以便视图控制器呈现链接回到根视图控制器 - 例如是一个子视图控制器。 – Tim