Facebook App Development gotchas

Friday 02/19/2010  –  Category: Uncategorized  –  No Comments

While developing a Facebook app earlier this week, I ran into a number of gotchas that make developing for Facebook just a bit more painful:

  • If you're developing within an FBML canvas page, you have to adjust your javascript to conform to FBJS. FBJS does a number of things--itwill prepend all your variables and function names with your appid, setting/getting object properties are done through custom methods, you can't create new elements in the DOM, etc. If you need to use heavy javascript, it would be easier to use an iframe-based application.
  • If you're developing a tab-based application, it will start in "passive mode" , which means your Flash and javascript won't run until the user interacts with your page. This means you can't use onload javascript methods until a user clicks something. This was very frustrating because some javascript I adapted to FBJS (to create pretty checkboxes) didn't end up working at all.
  • Also on a tab-based application, your image assets will be cached by Facebook's image proxy cache. For some reason, the proxy cache was really flaky earlier in the week; it would randomly show some assets but fail to load others and would vary on computer to computer and browser to browser.

StoreKit SKErrorUnknown

Friday 02/19/2010  –  Category: Uncategorized  –  1 Comment

I've been trying to integrate StoreKit for in-app purchases for a project at work. I opted to use Urban Airship because they provide a nice interface to upload content as well as a drop-in storefront interface.

Anyway, I was having no problems getting their sample client to work, but when I tried to integrate it into my app and purchase an item, I would get the message "Transaction Failed (0)", indicating an SKErrorUnknown error (thanks, Apple).

After hours of searching and emailing around for a solution, I finally realized that it must be something specific to my app. I discovered that my Info.plist file had a variable in the bundle version field that wasn't getting set. Apparently StoreKit needs an app's bundle version to work properly...changing it to "1.0" made it work!

Hopefully this will save someone from a few hours of frustration!

Flickr Original updated to 1.0.4

Wednesday 12/30/2009  –  Category: Uncategorized  –  13 Comments

UPDATE: Download Flickr Original 1.0.5
Download Flickr Original 1.0.4

Sorry guys, I stand corrected. Upon further investigation, the Flickr slideshow queries the API with their own special API key that expires every so often (daily, I assume). It's only when using this special API key that we can see the originalsecret and original format parameters.

If the extension has stopped working for you ("Sorry, Flickr Original could not view/download this photo."), it's because the special API key had expired. Please clear your cache (Firefox caches extension downloads) and re-download the extension which I've reverted it to use my own API key.

So...unfortunately, the ability to "view/download original images even if a user has disabled image downloading—provided that the original image's max dimension is less than 1280px" isn't going to be possible unless I can figure out a way to grab Flickr's special API key every time it changes.

Also, It looks like Flickr has changed the photos.getSizes API to not show the original size if the max image dimension <= 1280px.

I've made yet another update to Flickr Original! Thanks to an idea from Клименков Константин, you are now able to view/download original images even if a user has disabled image downloading—provided that the original image's max dimension is less than 1280px.

On this photo, you'll see that the "all sizes" option is not available because the owner has disabled photo downloads in their privacy settings. However, when you hit the "view as slideshow" button, the slideshow shows the original image. Looking at the net traffic in Firebug, we can see that the slideshow is calling the Flickr API with the photos.getInfo method.

Upon further investigation, it turns out that the photos.getInfo API returns two extra fields (originalsecret and originalformat) if the original image's max dimension is less than 1280px, even if the user has disabled image downloading. It's also interesting to note that querying an image's large size with photos.getSizes API returns an image cropped to 1024x____ if the original size max dimension is > 1280 but returns the original image if the the original size max dimension <= 1280.

In light of this, the extension has been updated to do the following:

  • Checks if an image has an original size available with the photos.getInfo method by checking if the originalsecret parameter exists
  • If so, manually constructs the original image url in the format http://farm{FARM}.static.flickr.com/{SERVER}/{ID}_{ORIGINALSECRET}.{ORIGINALFORMAT} so it doesn't need to make an extra API call to photo.getSizes
  • If the photo does not have originalsecret set, it is because a) the original image's max dimension is greater than 1280px and b) the owner is not a Flickr pro member or has not enabled downloading of their photos in their privacy settings. In this case, the extension calls photos.getSizes to get the largest size available.

Other updates:

  • The extension will now alert when the original size isn't available
  • When you are on a photo detail page of a photo that has downloads disabled ("spaceball.gif protected"), the extension now shows the view/download option in the context menu and extracts the Flickr photo id from the browser url
  • The extension uses JSON.parse instead of eval() for security purposes

Known issues:

  • The extension won't show view/download in the context menu on a photo detail page if you a) right-click on a portion of the image where there is a note (example) or b) the image is yours and you are logged in. To get around this, right-click where there is no note or on the image thumbnail instead.

Prowler 1.0.1

Saturday 12/26/2009  –  Category: Uncategorized  –  No Comments

I've updated the Prowler extension to make the API call in the extension instead of relying on a web service. Please upgrade for improved performance and reliability!

UPDATE: Download Prowler 1.0.2
Download Prowler 1.0.1

The web service (hosted on Heroku) will still be available for those running older versions of the extension.

View the original Prowler post

Flickr Original 1.0.3

Saturday 12/26/2009  –  Category: Uncategorized  –  2 Comments

(UPDATE: Version 1.0.4 available!)

I've updated the Flickr Original extension to use XMLHttpRequest instead of depending on a web service. It should be faster now since the API logic had been moved to the browser.

Download Flickr Original 1.0.3

The web service (now running on node.js) will still be available for those running older versions of the extension.

View the initial Flickr Original post

 Page 4 of 15  « First  ... « 2  3  4  5  6 » ...  Last »