开发者

issues using facebook iphone api to post image and text

I have been trying to use the facebook iphone api to publish an image and some text from my app (i.e. using FBRequest call:@"facebook.stream.publish" with the appropriate params.

I've found that the behavior is extremely erratic, as it first worked fine when I implemented it, then, completely stopped working (the request would fail and nothing would show up), and now sometimes posts only the text and most o开发者_开发技巧f the time posts only the image in a gallery style (returning a failure).

I've read that it's something broken on Facebook's side, however, I see other people's games posting things periodically with images and text and wonder if I might be doing something fundamentally different that is much less reliable or stable. Has anyone encountered such an issue or has more familiarity with this?


It looks like facebook royally screwed anyone who uses stream publish to get images posted. It appears they disabled the ability to put the image you send in your post. Check this bug thread near the June 10th timeframe.

http://developers.facebook.com/show_bug.cgi?id=7345

Short of hosting the image yourself, if anyone knows another way to get such a thing working, it'd be great to hear.


Same here, I implemented iphone based facebook image+text sharing using their own api a few days ago, and behavior went from seemingly ok to erratic and unpredictable.

What really annoys me, is that in the simulator it always seems to work. Have you seen this as well?

(btw I don't actually upload the image to facebook, I just publish the message with a link to the image hosted by myself)

You'd maybe better stick to a simple backend you can fully control yourself. The solution I use for social networks without a (stable) iphone api is to upload the image to my backend, and then just throw in a UIWebView, and let the backend handle all OAuth and publishing stuff. The UIWebView calls back on your app's

-(BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType

on every page load, which you could use to determine if the request failed, was a success, or entered a waiting state. It's kind of a hack but it is at least as reliable as your backend.

The main advantages are 1) you can fix things when facebook breaks them 2) there are 100s of proven libraries to use


UPDATE: You might want to add to FBStreamDialog.m a check if _session.apiKey is not nil. If it is, then the dictionary will remain empty, and the post will show up an empty screen.

The example code provided by facebook does:

FBStreamDialog* dialog = [[[FBStreamDialog alloc] init] autorelease];

see http://wiki.developers.facebook.com/index.php/Facebook_iPhone_SDK

FBDialog's init would then pick up the global session object, but it clearly fails occasionally.

When you manage the session yourself, and use:

[[[FBStreamDialog alloc] initWithSession:self.fb_session] autorelease];

Everything works ok.


There's a bit of confusion between the Facebook API and SDK.

See this answer, instead of stream.publish your meant to use feed, however when that answer was written you had to still use stream.publish, it may have been updated since. Hopefully I've pointed you in the right direction.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜