gpt4 book ai didi

ios - FBSDKShareContent 分享本 map 片

转载 作者:行者123 更新时间:2023-11-28 08:56:09 25 4
gpt4 key购买 nike

尝试通过 FBSDKShareLinkContent 分享本 map 片,但没有成功。

我的示例代码是:

 let content: FBSDKShareLinkContent = FBSDKShareLinkContent()
content.contentTitle = "test share"
content.contentURL = NSURL(string: "http://example.com")
let path = NSBundle.mainBundle().pathForResource("testImage", ofType: "png")
content.imageURL = NSURL(string: path!)
let shareDialog = FBSDKShareDialog()
shareDialog.mode = FBSDKShareDialogMode.Native
shareDialog.shareContent = content
shareDialog.fromViewController = self
shareDialog.show()

最佳答案

要共享图像,您需要使用 FBSDKSharePhotoContent。在 Objective C 中检查以下代码

- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = info[UIImagePickerControllerOriginalImage];

FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = image;
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
...
}

引用:https://developers.facebook.com/docs/sharing/ios

关于ios - FBSDKShareContent 分享本 map 片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32968264/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com