Reputation: 11753
I am having an issue with sharing an image on Facebook, from an iOS app. (See this post) I read that it was against Facebook policy to prefill text before sharing. Is it also contrary to their policy to prefill an image?
I can understand that prefilling can lead to possible exagerations. But in an app dealing with pictures, if I cannot make it easy for the user to share his picture by preloading it; what could be the point of having a FB button in my app?
Upvotes: 1
Views: 5710
Reputation: 1563
I also try to find out how to share a image to Facebook and their documentation didn't help me a lot -> https://developers.facebook.com/docs/swift/sharing/content-types/
In the end I manage to do it in this way:
import FBSDKCoreKit
import FBSDKLoginKit
import FBSDKShareKit
private func shareInFacebook() {
let photo = SharePhoto(image: image!, userGenerated: true)
let content = SharePhotoContent()
content.photos = [photo]
let showDialog = ShareDialog(fromViewController: self, content: content, delegate: self)
if (showDialog.canShow) {
showDialog.show()
} else {
self.view.makeToast("It looks like you don't have the Facebook mobile app on your phone.")
}
}
Hope this will help someone ;)
Upvotes: 1
Reputation: 1224
As my understanding, we can't prefill text, however, can share photos from your application to Facebook and there is no restriction of that. As they said, there are just some requirements
Here is the example code of using FBSDKSharePhotoContent to share photos via FB
- (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];
...
}
Reference: https://developers.facebook.com/docs/sharing/ios
Upvotes: 2