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