我使用Facebook iOS SDK和FBSDKShareLinkContent与文本共享网址和图片。分享时一切似乎都可以。但问题是在共享之后,应用程序的新实例被打开。已完成的共享仍在后台开放。
我做错了什么吗?如何避免呢?
以下是我用来分享的代码......
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.contentDescription = [[MusicPlayerHelper playerManager] getTextToShare];
content.contentURL = [NSURL URLWithString:[[MusicPlayerHelper playerManager] getURLToShare]];
content.imageURL=[NSURL URLWithString:[[MusicPlayerHelper playerManager] getImageURLToShare]];
FBSDKShareDialog *dialog = [[FBSDKShareDialog alloc] init];
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:@"fbauth2://"]]){
dialog.mode = FBSDKShareDialogModeNative;
}
else {
dialog.mode = FBSDKShareDialogModeAutomatic; //or FBSDKShareDialogModeAutomatic
}
dialog.shareContent = content;
dialog.delegate = _delegate;
dialog.fromViewController = _delegate;
[dialog show];