ios / Mac OS X1 Comment
May 12

Xcode 4.3.2 on OS X Lion fails to deploy app to an iPhone on iOS 5.1.1

A seriously frustrating and naturally time-consuming issue paralyzed me today.

Apple recently released the iOS 5.1.1 update to its mobile devices. Sounds minor and it probably was. But 5.1.1 also signaled the end of life for using OS X 10.6 Snow Leopard for developing for newer OS versions. Snow Leopard supports devices with iOS up to 5.1. Yup, not 5.1.1. Just 5.1. Not much of a heads up but well – time to move on to Lion. So I do.

Today came another surprise. The most current release version of Xcode – 4.3.2 – did not appear to enjoy my iPhone and its iOS 5.1.1. Organizer saw the device, added it to the provisioning portal team (removed, added, removed, added, etc.) and added and removed the provisioning profile for the app. Still, Xcode would fail to recognize the device and stick with the blank 'iOS Device' in the execution scheme.

Finally, I stumbled across this post in Apple's Developer Forum:

"The latest Xcode for Snow Leopard is 4.2 and that appears to be the highest it will go. 10.6.8 is required for iOS support.

The latest Xcode for Lion as of 5.7.2012 is 4.3.2, which requires 10.7.3 and is needed to work with iOS devices at iOS v5.1.x – v4.3.2 is an application that will be installed to your /Applications folder. Xcode 4.3.2 comes with 5.1 SDK and supports iOS 5.1.1…connect your device and let Xcode download 5.1.1 symbols."

The part I seemed to be missing seemed to be the "let Xcode download 5.1.1 symbols".

Further digging on StackOverflow had the answer: essentially power cycle your iOS device and THEN reconnect it to your Mac. Let iTunes start up and finish its scan of the device. Then close it and start Xcode. I ended up also restarting my machine. I then created a NEW project and had it detect the iOS 5.1.1 device successfully.

Still, I am unable to get projects that were created before 5.1.1 came out to detect the device. Luckily nothing is major there but this is clearly a rather grim bug in Xcode.

Feb 12

XCode iOS simulator is case insnsitive. iOS on Device is not.

We have an iPad app. We load images using file paths into the app. Images appear just fine in the iOS simulator. Images do not show up on the device. Fist shaken madly in the air, agony.

Thanks to my colleague Dolphy Fernandes we managed to discover the culprit. The iOS Simulator used by XCode loads file in a case insensitive manner. To it, a file called A55.jpg and a55.jpg are the same. iOS on devices, on the other hand, is case sensitive. Hence, A55.jpg will not load if the file name you are attempting to load is 'a55.jpg'.

Hope it helps…

Feb 11

SBJSON: Testing for nil / NULL value

I am playing with a variety of JSON frameworks in Objective-C. All are severely under-documented but then, they are simple to use, right? No. Nonetheless, I am deeply in awe and in debt to the great individuals who invested endless hours of their time to build these libraries and give them to us to use free of charge. Thanks you.

Anyway, SBJSON from Stig Brautaset, which I am examining right now, exposed a relatively weird issue. How do you test for null values in the contents of the parsed NSDictionary at hand? 

Plain old ([dictionary valueForKey:@"key"] == null) will not work. The breakthrough came when looking at the dictionary printout to gdb (Right-click the object in memory and select 'Print Description to Console'). The null value was 'stored' in a CFNull reference. To test whether a pointer is pointing at CFNull, you do this:

myVariable == kCFNull where kCFNull is a special memory address dedicated to hold this special null (nil!) value.