我正在开发一个应用程序,我必须分享照片和文字到脸书和FBMessenger,为此我使用FBSDKShareKit框架。无法同时共享文本和照片,因此我将文本复制到UIPasteboard,并想将其粘贴到Facebook应用程序或FBMessenger应用程序中。但当我分享照片时,文本不会被复制,但对于链接共享,UIPasteboard是有效的。
是否有解决此问题的解决方法。
提前感谢....
发布于 2015-07-15 17:40:54
我不确定我是否理解正确,但如果你想用Facebook SDK同时分享文本和照片,你可以尝试这样做:
NSURL *imageURL = [NSURL URLWithString:@"https://upload.wikimedia.org/wikipedia/en/d/d3/Nasa_mer_marvin.jpg"];
UIImage *image = [UIImage imageWithData:[NSData dataWithContentsOfURL:imageURL]]; // taking image from Wikipedia for example purposes
FBSDKSharePhoto *photo = [[FBSDKSharePhoto alloc] init];
photo.image = image; // your photo
photo.userGenerated = YES;
FBSDKSharePhotoContent *content = [[FBSDKSharePhotoContent alloc] init];
content.photos = @[photo];
if ([[FBSDKAccessToken currentAccessToken].permissions containsObject:@"publish_actions"]) {
FBSDKShareAPI * shareApi = [[FBSDKShareAPI alloc]init];
shareApi.message = @"Lorem Ipsum Dolor Sit Amet"; // your text
shareApi.shareContent = content;
[shareApi share];
}https://stackoverflow.com/questions/31198667
复制相似问题