How can I send a locally stored image with optional text from an iPhone to Facebook via their API? Any sample code would be great.
I have tackled this problem while integrating Facebook sharing features. In my experience, the process involves converting your UIImage into NSData, typically using UIImageJPEGRepresentation to get the proper data format. This NSData object is then attached alongside your custom text in the parameters of a POST request to the Facebook Graph API. The FBSDKGraphRequest class simplifies this procedure. I encountered issues when the content type was mismatched, so double-checking the MIME type was essential. Testing with various parameters gave me clearer insights into handling potential errors.
i found using png data conversion worked better sometimes than jpeg. also checking all fb permisions fixed my upload issues. hope this gives u a hint