Home » iPhone Development

Disappointment is…

9. October 2008 by james 0 Comments

Disappointment is having an application work beautifully under simulation, getting excited at trying your creation on actual hardware and then…. it doesn’t even compile for the physical platform.  Bah. 

I’ve had my native iPhone application running pretty well under simulation for close to a week now and have reached the point where I’d like to try it on a physical device and see how the UI choices I made do or don’t work as expected.

Setting XCode to compile for the iPhone itself rather than the simulator yielded two problems.

1) NSCalendarDate isn’t supported.  Ok fair play to this one, looking at the documentation gives the message up at the top that NSCalendarDate is due to be deprecated and you shouldn’t use it.  My bad for not reading the documentation properly.

2) NSXMLDocument, NSXMLElement, and NSNode aren’t present either.  The reason I’ve seen suggested is that a full DOM for XML was deemed rather heavyweight for the phone. 

In both cases, I can see the logic and am fine with these omissions but why on earth didn’t the simulator tell me two weeks ago when I wrote the code?  I was expecting to see runtime issues that showed where the simulator and physical reality differed but not fundamental library differences.

For those who stumble over this then for the date/calendar issue, the documentation for NSCalendarDate points you to classes which between them can provide the functionality you’re looking for (not as nicely unfortunately).  As for XML, if you do need access to a DOM and a forward-only reader won’t do then try the touchcode googlecode project which provides a libxml based replacement set of classes in TouchXML.  Be warned though – you may well find implementation differences to the NS* classes.  Apple presumably had a good reason for their decision on iPhone XML support so the other point to consider is whether your design is best suited to requiring DOM access when a forward-only reader might do the job just as well.

Sigh, rant over and back to fixing the bugs.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Comments