Posted by: bearc0025 | June 16, 2009

Facebook Connect for iPhone – Facebook Developer Wiki

While connecting to Facebook isn’t rocket science, it isn’t 100% straight forward either. These links sd help…

Facebook Connect for iPhone – Facebook Developer Wiki

Their api is pretty good, but doesn’t match 1-to-1 for their Objective-C library as far as params:

http://wiki.developers.facebook.com/index.php/Photos.upload

This page helps step you thru getting their code in your project…

http://www.mobileorchard.com/marketing-in-code-part-2-setting-a-users-status-in-facebook-from-an-iphone-app-a-tutorial/

I had to make a change to the Facebook code for uploading an image. Their doc says the upload file parameter is to be raw data which their code handles, however, it states there is no name. That’s fine. But, the sig generation doesn’t handle this well. If there’s no name, it sdn’t add it to the sig…


- (NSString*)generateSig {
 NSMutableString* joined = [NSMutableString string]; 

 NSArray* keys = [_params.allKeys sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];

 for (id obj in [keys objectEnumerator])
 {
  // if there's no name, don't add it to the sig
  if (0 == [obj length])
   continue;
  [joined appendString:obj];
  [joined appendString:@"="];
  id value = [_params valueForKey:obj];
  if ([value isKindOfClass:[NSString class]]) {
   [joined appendString:value];
  }
 }

Advertisements

Responses

  1. Funny, I just went through all that process integrating Facebook Connect with Flower Garden. I even had to make that exact bug fix on FBRequest! 🙂

  2. for (id obj in [keys objectEnumerator])

    should be written as

    for (NSString* obj in keys)

    • I agree – that’s how I would do it. But their way seems to work fine too. Thanks!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: