Monday, September 13, 2010

Modifying XCode to Run the TapLynx Sample

With the release of the new iPhone SDK 4.1 Apple has eliminated the 2.2.x build options but has also oddly eliminated the ability to build in 4.0. I've never seen this before, but that is the way. Now, the default build of TapLynx doesn't work without a few (thankfully simple) changes.

If you try a build and run with the current TapLynx sample code (as of Sept 13, 2010) and XCode with a 4.1 SDK, you will get this error
before you even try to Build and Run you should notice this in the menu bar and know that your build will fail
What XCode is telling you is that it doesn't know what SDK 4.0 is anymore.

To fix this and run your shiny new TapLynx sample you need to tell your project file that it should run with the 4.1 sdk. To do that select the project document and right click (or control click if your mouse has but one button)
or under the "Project" menu. Select "Edit Project Settings"

You should notice in bold letters that "iOS Device 4.0 (missing)" is the value for Base SDK. This is the cause of the error. However, if you just change that to "iOS Simulator 4.0 or "iOS Simulator 4.1" you will might still get the error if the Build Configuration is at anything other than "Debug". So, the fastest way to "Yay!" is to set All Configurations to have a Base SDK of either "iOS Simulator 4.0" or "iOS Device 4.1".

If you choose to set your base SDK to iOS Device then make sure that you set the active SDK to either the simulator or the device depending on how you are testing the app. Either use the Project menu to "Set Active SDK" or use the Overview dropdown to set either "Device" or "Simulator".

Good Luck.

Friday, September 10, 2010

Using YouTube RSS Feeds in TapLynx

If you are using the TapLynx framework to build an application then adding a video feed might very well be a requirement. has an API with gdata (the Google data technology) so that you can turn lists of videos into RSS feeds and TapLynx will work well with them.

The TapLynx support website has a few suggestions for how to work with the gdata feeds. Once you have created a playlist or if you want all of the videos uploaded by a user you can get set up pretty quickly.

I recently wanted to go a little beyond that as I wanted to create some feeds that query YouTube and return whichever videos match my query. The Google data api allows for me to create a url that contains my search parameters and it will return an rss feed for TapLynx. If I wanted to get five videos that pertain to Jimi Hendrix, I could use this URL
The "q" parameter is where I can put in my search terms. The "max-results" parameter is how I can constrain the number of videos returned. This url will function and it will return me five Hendrix clips from YouTube. There is only one problem. Three of the clips are not encoded for the iPhone and they won't play on the iPhone.

All YouTube videos by default are encoded to play in the Flash player. Many (but not all) videos have alternate encodings that YouTube will use when an iPhone or HTML5 device or other non-Flash device asks to play them. Thankfully there is a format parameter that we can add to our URLs to return only videos that provide the alternate formatting. The default format for all YouTube videos is "5". So the flash version of each video is denoted by a "5". The iPhone would like to have things that are designated with a format of "6". So, using our example above we can just add a formatting parameter and feel secure that all of the videos that are being returned can be played on an iOS device. Our Hendrix example now looks like
and it returns five video clips (three that were in the original list and two that replace the ones that only have a Flash version) all of which will play on an iPhone.

So, if you are trying to generate rss feeds of YouTube videos for an iPhone application hopefully this will help you ensure that all of the videos play.