4

I'm posting to a group user wall, (image and text). It have worked from a long time, and stop working recently(now, image are posted, but no text :( ). Any idea if there was a new way or rules? (no error reported)

    [params setObject:sContent forKey:@"message"];
    [params setObject:yourImageData forKey:@"picture"];



    [[[FBSDKGraphRequest alloc]
      initWithGraphPath:@"xxxxxxxxxxxxxxx/photos"
      parameters: params
      HTTPMethod:@"POST"]
     startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
         if (!error) {
Franck
  • 8,939
  • 8
  • 39
  • 57

1 Answers1

2

Following is the working code for me(In Swift):

let params = ["message": "Test message", "sourceImage" : UIImagePNGRepresentation(UIImage(named: "test.jpg")!)!]
FBSDKGraphRequest(graphPath: "me/photos", parameters: params, HTTPMethod: "POST").startWithCompletionHandler({ (connection, result, error) -> Void in
    guard let response = result else {
        print("No response received")
        if let errorInfo = error {
            print("errorInfo: \(errorInfo)")
        }
        return }

    print(response)
})

Check 'Publishing' section at the link for more.

Let me know if you have any difficulties to convert it to Objective-C.

Ashok
  • 5,585
  • 5
  • 52
  • 80
  • Yeah, I just supplied working snippet in swift for future use and set the image data for the key "sourceImage", not for the key "picture". I have tried with the key "picture", it's not working for me for some reason, so I have tired it using "sourceImage" and it's working for now. – Ashok Mar 22 '16 at 05:17
  • In my case i can see the picture, but no text. – Franck Mar 22 '16 at 18:05
  • I'm able to see both title and picture. – Ashok Mar 23 '16 at 06:27
  • Finally, it was a tenporary bug from facebook (1 week after my post, it was resolved by itself) – Franck Jan 11 '17 at 23:21