Under the Bridge

Facebook Graph

Well, isn’t this just insanely convenient. Monday morning we put Facebook Connect into the latest project, by Monday afternoon the beta testers were squawking their beaks off about seemingly all the issues you’re no doubt familiar with if you’ve had occasion to encounter the less than exemplary user experience which is Facebook Connect, so Tuesday morning we were grumpily coming to the conclusion that maybe it’d be better to just toss that junk completely and start in learning our way around the new stuff from Facebook …

… and what ho, with a synchronous sense of timing so superb as to border on suspicious, Tutorial Virtuoso Ray Wenderlich promptly publishes:

How To Use Facebook’s New Graph API from your iPhone App

Well, doesn’t that just beat all hollow the idea of figuring out all that authentication mumbojumbo ourselves, indeed.

And if all you’re wanting is to toss some spam up on the user’s wall and don’t really care what happens once it’s thrown, as is indeed our exact situation, here’s how to go about doing that while you’re waiting for the followup tutorials:

- (void)sendToFacebook:(NSString *)message
{
NSString *fbFeedLink = @"https://graph.facebook.com/me/feed";
NSString *access_token = [[NSUserDefaults standardUserDefaults] objectForKey:kQMPrefFacebookAccessToken];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:fbFeedLink]];
[request setPostValue:access_token forKey:@"access_token"];
[request setPostValue:message forKey:@"message"];
[request startAsynchronous];
}

where kQMPrefFacebookAccessToken is the token that you got by using the login dialog from the sample project, and ASIFormDataRequest is from the ASIHTTPRequest library. Looks much simpler and better working so far; but if there’s any issues, we assure you our beta testers will have them for you. Within minutes, more likely than hours. Of course, we suppose we’d be even more stressed if they weren’t so gleefully enthusiastic about outdoing all the rest in locating the most pathologically obscure bugs possible…

UPDATES:

Part 2 is up –

How To Get a User Profile with Facebook’s New Graph API from your iPhone App

And the final Part 3 –

How To Post to a User’s Wall, Upload Photos, and Add a Like Button from your iPhone App

0