issues using facebook iphone api to post image and text - iphone

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?

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.

Related

determining vertical vs horizontal photo in Zapier

I am receiving iPhone photos from the Sendblue messaging service and need to determine if they’re vertical or horizontal. This seems like it should be really easy but is giving me trouble. They’re in a CDN (link to example photo).
Any solution would be good, ideally it's something simple and doesn't require another app. Seems like this should be much easier than it is not sure what I'm missing.
So far I’ve tried this post and the CLI that resulted from it, but when I try to add it doesn’t show up in my apps.
I also tried the “mallabe” Zapier app, but it’s saying the photo isn't “publicly accessible”. This confuses me as the photo seems accessible to anybody I send it to.
AirEXIF is another solution I am looking into, I just applied to use their app so waiting to hear back on that front (not much activity from them recently so hoping they're still around).

Is there any way to get the 206px version of a photo via the Facebook Graph API?

I'm trying to get version of a photo that FB uses as the background image for album layouts where one side is always exactly 206px and the other one at least the same, for example https://fbcdn-sphotos-b-a.akamaihd.net/hphotos-ak-xpa1/v/t1.0-9/p206x206/10401476_409218399235620_1454525834273554679_n.jpg?oh=eda59fce63113796b35c46cc4bec162a&oe=55760EFD&gda=1433681435_6b4729404e05493108c271a50c753d7f I've scoured both the graph and SO, but am having absolutely no luck here. I'm aware that you can get 3 versions of a photo using type=album/thumbnail/normal ie https://graph.facebook.com/409218399235620/picture?type=album (you'd think this one would work, but they probably never updated it to redirect to the new size?). I've tried all kinds of variants of this knowing that the graph documentation is pretty crap, to no avail.
I've also used the Explorer to for example pull up ?fields=images, but it's never one of the listed images there. I've tried using widths, replacing parts of the URL etc. etc. I am running the checks with a valid access_token.
I've pretty much resigned myself to just resizing myself, but given the time I've spent on this, I thought I'd at least put it out there in case someone else has had the same problem, and come up with a solution.

Desired image sometimes is not shared in status via Facebook Graph API

I am developing on iOS 4.0(supporting higher versions too).
I am using facebook Graph API, and so far everything works as it should. I can update statuses with images and stuff.
But, there are weird things happening.
I am passing in my FB init class an image link.
But when the FBDialog appears, sometimes the image is there, and sometimes it's not! And i was debugging for a whole while, and i can say for sure: in both cases(when it is and when it's not) the link is not just working: it's totally the same. Practically, i can't find any differences in both behaviors.
What could be the reason? Any help would be greatly appreciated! Thanks!
The problem was in my appid. not sure exactly what was the problem, but changing it solved it.

How to Style Facebook Activity Feed

How do you implement custom css on a Facebook activity feed plugin? This related post does not fully answer the question. Is this the right way?
Where does the
<fb:tag name='link'></fb:tag>
go? Inside of of the
<fb:activity site="..." app_id="..." ></fb:activity>
outside of it, before or after? I'm sort of confused...
the only way i use activity feed is when its in a widget that will generically upate in all posts. Anyone who inserts these snippets into blog posts or other 'hard to find and edit later' posts and pages, will regret it
Why?
Because Facebook changes their script every month or so and the script snippet you inserted wont work anymore
I have hundreds of blank areas in blog posts where i inserted an activity feed and the script always stops working after some weeks when fb adds some code or changes the location of some script or renames a file and the old script has no canonical or generic way of readjusting.
There is no point in using a script which gets made obsolete every month and you then need to find all posts where you inserted the snippet and change it for the new working code.
Im always having to reinsert new code into my fb social widgets because they cease to function...
Not viable unless you take it into consideration. Only insert in spaces where oyu wil notice it when it stops working
As Facebook Answers answered, you cannot really style it with a custom CSS, nor via JS, as the activity feed widget creates an iframe.
The info from martincarlin87 is useful, but that is not exactly what you get with the Activity Plugin, which is what you meant I guess:
http://developers.facebook.com/docs/reference/plugins/activity/
For using this you cannot really interact with the Facebook API, it is a little world apart. By now... (July 12th 2012)
Facebook PHP SDK: https://github.com/facebook/php-sdk
Comes with some simple examples, I would suggest uploading it to your server and tinkering with it, Facebook has a steep learning curve but here at Stack Overflow there is even a Facebook section: facebook.stackoverflow.com so just take each step at a time and if you can't get it by reading the facebook docs: developers.facebook.com then you can always ask here and I'm sure someone will be able to help you.
Getting Started: http://developers.facebook.com/docs/reference/php/
Once you have made an app, you add it to your fan page and then you will be abel to test what information you can get using the Graph API Explorer: https://developers.facebook.com/tools/explorer
That post you refer to is a red herring I'm afraid. If you put any HTML between the activity tags it gets rendered BEFORE the iframe is added. So its a no starter, from what I can see. However, I eventually found a solution, which I gave on that thread. I am repeating it here in case somebody searching doesn't see the other thread.
I managed to customise an Activity plugin, after a great deal of effort.
You can see the result here:
http://www.quniverse.co.uk/shopdata/about_us.php
Feel free to post a comment on that site, it exists purely for test purposes so I'm not fussed what goes up there provided its clean.
I explain how I achieved this in the blog article posted here:
http://facebookanswers.co.uk/?p=302
To summarise briefly:
You cannot insert CSS into the activity plugin.
Rely on the fact it has a transparent background, and supply your own.
Turn off the header and supply your own.
You can specify a light or a dark font, a few fontfaces and a border colour.
If you read the blog article you will get a full explanation.

How are real time updates in Facebook, Twitter and Google Plus performed

When I try to implement a real time update system on my site, I usually make an ajax call, say every 5 secs to a processing file, say getUpdates.php (not sure if it's the right way to do). Get the updates from there and display it. Doing that, when I look at firebug or the developer tools in Chrome and Safari, I can see the file being called ever 5 secs in the XHR section of the tool; after which the updates are displayed.
In case of Google plus, twitter and Facebook, I don't see such a regular call although updates are appearing right in front of me.
How is it that they are doing or is it me not noticing such a regular call??
They use "Long polling" I think. Sounds like a fine excuse to dabble with node js if you ask me. :)