FBSDKShareDialog 在没有安装 Facebook App 的情况下无法分享照片,IOS
FBSDKShareDialog doesn't share Photo without Facebook App installed, IOS
我正在使用 Facebook SDK 4.0,https://developers.facebook.com/docs/sharing/ios#share_dialog
我正在使用 FBSDKShareDialog
来分享 Photo.It 如果用户安装了 Facebook 应用程序,我会分享照片,
但是当用户没有安装 FB App 时它会失败。但他们说 "If someone doesn't have Facebook app installed it will automatically falls back to a web-based dialog."
我不知道怎么了,请帮助我使用 FBSDK 4.0 分享照片。
我的密码是
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.capturedImageView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
这是错误报告
error:"com.facebook.sdk:FBSDKErrorArgumentNameKey=shareContent,
com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Feed share dialogs
support FBSDKShareLinkContent."
FBSDKShareDialog 仅支持 FBSDKShareLinkContent 到 post 图像或 URL.So 使用共享对话框你必须使用 FBSDKShareLinkContent。
您可以按如下方式使用它:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg"];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
如果你想分享一个 link 那么只需使用 content.contentURL
.
参考:https://developers.facebook.com/docs/sharing/ios#share_dialog
如果您使用的是 FBSDKSharePhoto,那么您需要为 iOS 应用程序安装本机 Facebook。
我也遇到了同样的问题,因为文档还说他们提供了回退机制,这在这种情况下似乎不正确:
Built-In Share Fallbacks
In past versions of the SDK for iOS, your app had to check for a
native, installed Facebook app before it could open the Share Dialog.
If the person didn't have the app installed, you had to provide your
own code to call a fallback dialog.
Now the SDK automatically checks for the native Facebook app. If it
isn't installed, the SDK switches people to their default browser and
opens the Feed Dialog. If someone wants to share an Open Graph story,
the SDK opens the Web Share Dialog.
先配置 iOS 设备的 Facebook 帐户,然后使用以下代码即可:
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.capturedImageView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
我正在使用 Facebook SDK 4.0,https://developers.facebook.com/docs/sharing/ios#share_dialog
我正在使用 FBSDKShareDialog
来分享 Photo.It 如果用户安装了 Facebook 应用程序,我会分享照片,
但是当用户没有安装 FB App 时它会失败。但他们说 "If someone doesn't have Facebook app installed it will automatically falls back to a web-based dialog."
我不知道怎么了,请帮助我使用 FBSDK 4.0 分享照片。
我的密码是
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.capturedImageView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
这是错误报告
error:"com.facebook.sdk:FBSDKErrorArgumentNameKey=shareContent, com.facebook.sdk:FBSDKErrorDeveloperMessageKey=Feed share dialogs support FBSDKShareLinkContent."
FBSDKShareDialog 仅支持 FBSDKShareLinkContent 到 post 图像或 URL.So 使用共享对话框你必须使用 FBSDKShareLinkContent。
您可以按如下方式使用它:
FBSDKShareLinkContent *content = [[FBSDKShareLinkContent alloc] init];
content.imageURL = [NSURL URLWithString:@"http://upload.wikimedia.org/wikipedia/commons/3/36/Hopetoun_falls.jpg"];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];
如果你想分享一个 link 那么只需使用 content.contentURL
.
参考:https://developers.facebook.com/docs/sharing/ios#share_dialog
如果您使用的是 FBSDKSharePhoto,那么您需要为 iOS 应用程序安装本机 Facebook。
我也遇到了同样的问题,因为文档还说他们提供了回退机制,这在这种情况下似乎不正确:
Built-In Share Fallbacks
In past versions of the SDK for iOS, your app had to check for a native, installed Facebook app before it could open the Share Dialog. If the person didn't have the app installed, you had to provide your own code to call a fallback dialog.
Now the SDK automatically checks for the native Facebook app. If it isn't installed, the SDK switches people to their default browser and opens the Feed Dialog. If someone wants to share an Open Graph story, the SDK opens the Web Share Dialog.
先配置 iOS 设备的 Facebook 帐户,然后使用以下代码即可:
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = self.capturedImageView.image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
[FBSDKShareDialog showFromViewController:self
withContent:content
delegate:self];