简体   繁体   中英

Problems with attach JSON on FBDialog using FBConnect on my iPhone App

I'm trying to publish a post on the wall using FBConnect on my iPhone App, but I'm having a very stranger issue with the attach JSON.

When I use the sample JSON that FBConnect includes it works great, the code is:

dialog.attachment = @"{\"name\":\"Facebook Connect for iPhone\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\",\"caption\":\"Caption\",\"description\":\"Description\",\"media\":[{\"type\":\"image\",\"src\":\"http://img40.yfrog.com/img40/5914/iphoneconnectbtn.jpg\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}"; 

But, when I change the image source URL to another image hosted on my own server, it shows me correctly the FBDialog and the preview post, but when I tap the publish button, the Dialog dismiss as usual, but the post does not appear on the wall.

This is the attach JSON after the changes:

dialog.attachment = @"{\"name\":\"Facebook Connect for iPhone\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone\",\"caption\":\"Caption\",\"description\":\"Description\",\"media\":[{\"type\":\"image\",\"src\":\"http://myownserver.com/myImage.png\",\"href\":\"http://developers.facebook.com/connect.php?tab=iphone/\"}],\"properties\":{\"another link\":{\"text\":\"Facebook home page\",\"href\":\"http://www.facebook.com\"}}}"; 

Any idea of where is my mistake? Thanks.

After many attempts and no progress, I decide to try something unusual. I changed the server where my picture was hosted... And it works! I do not know what caused it, but apparently the Facebook API produces some problems with some servers.

I hope this can be useful to someone. Greetings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM