2009-09-21

Starting an iPhone app with status bar hidden with SDK 3.0


Summary: if you started an iPhone project before SDK 3.0 came out and all of a sudden you’re (wrongly) seeing a status bar at launch, convert your App-Info.plist to an XML format.


It was supposed to be easy, in the application info plist you need to enable this key



UIStatusBarHidden



But for some reason this was not working for me.  I was pretty sure this was working at some point before, but git bisect wasn’t helping me out.  Naturally, I googled around for several hours with no luck, but every time I start a new app, setting UIStatusBarHidden just worked correctly.


It got to a point where I was going to rewrite the whole app (if I had done that from the start, it probably would have taken less time), but then I noticed something - my (bad) Curling-Info.plist file was a pseudo-array like this:



{

UIStatusBarHidden = YES;

}




Whereas in the new (good) plist, it was in an XML format:


<?xml version=”1.0” encoding=”UTF-8”?>
<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>
<plist version=”1.0”>
<dict>

<key>UIStatusBarHidden</key>
<true/>

</dict>
</plist>

I even tried playing around between “true” and “yes” and the only conclusion I can come up with right now is, the XML version just works where the curly brackets fail.


I’m 99% certain that the old way (non-XML) worked with pre-3.0 SDK - it must be some backward-compatibility error Apple introduced with the new SDK.  The XML file is (I’m guessing) new in 3.0, and in the process, some of the properties using the curly brackets stopped working.


No comments:

Post a Comment