I am writing an iOS photo sharing application.
Using Swift Technology and FBSDK 4.0.1
I found that sharing photos with FBSDKShare Photo Content () CANNOT get back the message id from the result object in the FBSDKSharingDelegateinside of the method didCompleteWithResults.
The result object contains an empty string:
[:]
However, sharing FBSDKShare URLs with a Content Contents () link can return a message identifier from a result object. something like that:
[postId: 10000844250000_146108069750000]
Part of my main code:
Image controller ( UIImagePickerControllerDelegate, UINavigationControllerDelegate)
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject]) {
var theImage:UIImage = info[UIImagePickerControllerOriginalImage] as! UIImage
uploadImage.image = theImage
self.dismissViewControllerAnimated(false, completion: nil)
}
@IBAction func postButtonClick(sender: AnyObject) {
let photoContent = FBSDKSharePhotoContent()
let photo : FBSDKSharePhoto = FBSDKSharePhoto()
photo.image = uploadImage.image
photo.userGenerated = true
photoContent.photos = [photo]
FBSDKShareDialog.showFromViewController(self, withContent: photoContent, delegate:self)
}
Facebook FBSDKSharingDelegate
func sharer(sharer: FBSDKSharing!, didCompleteWithResults results: [NSObject: AnyObject])
{
println("sharer didCompleteWithResults, results.count\(results.count)")
println(results)
}
func sharer(sharer: FBSDKSharing!, didFailWithError error: NSError!) {
println("sharer NSError")
println(error.description)
}
func sharerDidCancel(sharer: FBSDKSharing!) {
println("sharerDidCancel")
}
.