Monday, August 30, 2010

iAd Tip

Posted this on my site but thought it was worth posting here too. When you are viewing an iAd sometimes the dismiss "x" doesn't seem to work.

No worries, just press the "Home" button. The iAd will exit and you'll return to your application.

Saturday, August 28, 2010

Info.plist Cheat Sheet

Updated: Nov 1, 2010

I routinely need to look up information about entries in an applications Info.plist. I even saved the Apple PDF to my hard drive. Still, I find myself looking for an example. Of course there is no one perfect Info.plist but here's a sample that I put together for a universal app that we want to only run on an iPhone 3GS or newer device. After reading a few threads on the Apple Dev forums it was pretty clear that the arm7 entry for the UIRequiredDeviceCapabilities key is NOT working. So, as a work around we can use opengles-2 (which of course requires an arm7 cpu).

BONUS TIP #1: Use Xcode to edit your Info.plist files. Why? Because it knows about all the entries and saves you from copying and pasting or typing the wrong one. Go ahead, try it now... I'll wait. Add a new row and look for "Icon Fi" and you'll see both "Icon File" and "Icon Files" in the drop down. :-)

Sample Info.plist
Let's highlight some entries:
  • UIPrerenderedIcon - turns OFF the gloss effect on your icon. Note you can still use a square icon and it will be rounded. This only effects the shine
  • Icon file - used by older iOS's to know the name of your icon. Yes you can name your icon "my_super_cool_app_icon.png", but why???
  • Icon files - used by iOS 3.2 (iPad) and higher. The tricky part is its an array of icon names and you really can't go wrong by following Apple's example. Each icon listed is for a different purpose and no you don't need them all for just an iPhone app but why not just get in the habit.
  • UIStatusBarHidden - Ever notice some games or apps launch and you can still see the statusbar and then once the app finishes launching it disappears, yeah me too. They didn't know about this entry, keeps the statusbar from showing.
  • UILaunchImageFile~ipad - Ah the iPad and its damned "you can hold it anyway you want" crap! Sorry... This entry says HEY iPAD! look for an image named "Default-<orientation>.png" e.g. Default-Landscape.png. For example, suppose you want to include portrait and landscape launch images for iPad using the base name MyiPadImage.png. You would include the UILaunchImageFile~ipad key in your Info.plist file and set its value toMyiPadImage.png. You would then include a MyiPadImage-Portrait.png file and a MyiPadImage-Landscape.png file in your bundle to specify the corresponding launch images. Which leads us to:
  • UIInterfaceOrientation - This tells the device, look I'm going to startup in THIS direction. See how it matches the above image.
  • UISupportedInterfaceOrientations - this array tells the device which orientations your app supports. And finally.
  • UIRequiredDeviceCapabilities - this array tells the device, here's what we need to run. If you don't meet these requirements, don't even install me. This of course works on the device via the AppStore and it works through iTunes. It will pop-up an error saying "MySuperCoolApp" cannot be installed on Greg's iPhone because it doesn't meet the requirements. So here is where we can limit our app to only run on arm7 devices by requiring opengles-2. 
Which now that I think of it makes perfect sense why using the cpu key isn't a good idea anyway. Who's to say Apple's next cpu won't be arm8 or something.

BONUS TIP #2: You can add your own keys to the Info.plist file and then pull them out using:

NSString *myKey = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"MyCoolKey"];

Have any other Info.plist tips or questions? Post a comment.

BONUS TIP #3: Use Xcode 4 beta to open and save your project and you'll get a bunch of these entries and more in your Info.plist


Link to Apple Dev Docs

Friday, August 27, 2010

Mental Health Day

After about three weeks of hammering out code on Legends of Hylore and learning cocos2d at the same time, I literally heard one of my brain cells pop! Yup, scared the crap out of me.

So this was the perfect time to switch modes and do some.... more coding??? Yes, its what relaxes me and it was a project I'd been putting off for quite awhile. A Contact Lens Tracker.

I know, there's quite a few in the app store now and most of them are free... but they all pretty much suck. I wanted an app where I could tap a button when I started a new pack of contacts and then IT should remind ME when to change them. IT should also remind me to order more contacts before I run out and as a final touch it should even remind me when to call for an eye exam.

Well IT is called Lens Tracker and is now ready for sale.

So now that that's out of my system I can get back to Legends of Hylore, well rested and ready to go!

2nd try...

Well this is now my second attempt at blogging. Let's hope I do better this time 'round.