Aleksandar • Vacić

iOS bits and pieces

Better icons for your iPhone apps on the iPad

When you have iPhone apps installed on the iPad, chances are they are doubly-ugly: they look pixelated when doubled and their icons are even more ugly extrapolated from 57x57px to 72x72px.

Recently, David Frampton posted great idea how Apple should have done this (the idea got picked by Daring Fireball, TUAW and many others). While idea is great, it’s more than doubtful that Apple would do this.

What Apple would likely prefer is that you, as developer, make an iPad version of your iPhone app and use the full capability of the device. In the process, you’ll create proper iPad icons and no ugliness then. In the Apple’s DevForums, there’s a thread with guidelines on how to populate App-info.plist file and what icon files are needed.

In there, it says that for iPhone-only apps you need to populate CFBundleIconFile key with 57px icon. However, if you move down a bit, you’ll find section on setting up universal app. Do that, even if your app is not universal and voila - iPad will use the proper icon for your iPhone-only app.

Setting up icon meta data, so it displays proper icons on iPhone/iPad

The settings above are from my Quickie to do app - here’s before and after:

Quickie icon on the iPad, before and after

Much better looking.

Always use isEqualToString for string comparisons

While working on my iPhone app Quickie, I encountered one of many examples why you must always check your code on the actual device.

Quickie uses Core Data for storage and in one particular place I was comparing the NSString variable to a NSString-typed property of my CoreData class, QuickieList. Like this:

if (QuickieList.listName != theListName)

listName is defined as NSString and theListName is obviously that as well. In this particular instance, both of those had the value of “test”.

In the iPhone Simulator (running on 10.6.2) this comparison returned false, but on the iPhone running 3.1.2 it returned true. When changed into:

if (![QuickieList.listName isEqualToString:theListName])

result was the same.

Never – I repeat – never assume that simulator testing will be fine, even for seemingly small things. It can bite you when you least expect it.

UITextField.text is not always there

If you have UITextField on the page and you need to validate is there something in it (so if yes you can save the input or something), you might do something like this:

if (![addNewCellTextField.text isEqualToString:@""]) {


However, this will fail if the field is never touched. That is, until your user taps the field and it gets focus, UITextField.text is nil. Which means that condition above yields true, which is not what you want.

Once it is touched though, this becomes an instance of NSString with value of @“”. Thus, always use:

if (addNewCellTextField.text != nil && ![addNewCellTextField.text isEqualToString:@""]) {


Watch out for this little trap hole.

iTunes 9 on Windows 2003 - the complete solution

Some of the stuff here also apply to problems appearing during installation or use of iTunes 9 on Windows XP, Vista or Windows 2008. Meaning - do try them, it might help you solve the issues you’re having.

What does this solve?

If you have any of these issue, this article will most likely help you.

  1. You use Windows 2003 and iTunesSetup.exe refuses to run on it (it’s touting only XP or Vista/Windows 7 as supported OSes).

  2. At the end of the iTunes install, when dialog says “Starting services” it failes to start iPodService.exe with the following message: “Service ‘iPodService’ (iPodService) failed to start. Verify that you have sufficient privileges to start system service.”

  3. You have trouble starting iTunes.exe after install.

  4. You see dialog boxes telling iTunesHelper.exe failed to start.

My wife uses Windows 2003 as development machine and I had all of these happening.

iTunes refuses to install due to OS mismatch

Apple is – like many other companies do in the last year or two – touting iTunes 9 as compatible only with Windows XP and Vista or Windows 7. This is safe net for them. If you run Windows 2003, this is just about the same thing as XP, regarding ordinary software.

Thus, solution here is to kill the OS-based launch conditions, which good people at WebKeyDesign have already explained how to do. The solution goes like this:

  1. Unpack iTunesSetup.exe so you have all the various .msi files inside it copied to some folder. Use Winzip, Total Commander or any other de-archiver to open iTunesSetup.exe and extract the files

  2. Download free tool called InstED and start it

  3. Drag all .msi files into InstED

  4. For each of them, find the LaunchCondition key in the left panel and then in the right-panel look for ((VersionNT=501 And ServicePackLevel>=2) OR VersionNT>501) and delete it. Then save the file.

InstEd - removing launch conditions

QuickTime has two conditions, remove both

Once you’re done with all of them, install them, one by one. Start with AppleApplicationSupport, then AppleMobileDeviceSupport and then continue until iTunes as the last. Ignore SetupAdmin.exe

iPodService.exe failed to start

At the end of iTunes installation, it will try to start iPodService.exe. This fails and manifests in a variety of ways. There’s an amazing number of “solutions” on the net, but remarkably none has pinpointed the actual cause.

It’s Data Execution Prevention feature of the Windows – it will kill the process as soon as it tries to run. DEP is made to prevent malicious software using private or undocumented API or doing any sort of suspected malicious activity. iPodService.exe falls into this trap according to DEP, so we need to tell DEP to let it go as exception to the rule.

Here’s how:

  1. Right-click My computer, choose Properties

  2. Go to Advanced tab, click on Settings under Performance, then onto the DEP ta``` objective-c

  3. Click Add, go to Program Files\iPod\bin and choose iPodService.exe

  4. Retry/continue the iTunes installation and it will finish it up very quickly.

Data Execution Prevention is what kills iPodService.exe

iTunes.exe or iTunesHelper.exe don’t start

You click, they appear to start but then fail. The reason is the same as above: DEP. Add both .exe files (they are in Program Files\iTunes folder) to the DEP exception window and they will start just fine afterwards.

To expand this a bit – every time you have a known, valid software failing to start, always add them to DEP and see if they work. Most likely they would.