views:

308

answers:

3

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 of 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?

A: 

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.

Joey
A: 

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

mvds
A: 

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.

mvds