iPhone SDK 3/4 App will not run on a iPhone 2.x device even with deployment target set to 2.0
I know about the difference between the base/active SDKs and the deployment target. I have my base SDK set at 4.0 and the deployment target set at 2.0. I am not using any APIs post 2.x, conditional or otherwise. Since I can't debug on a 2.x device, after building it, I use the iPhone Configuration Utility to install the app on the device, which it does just fine. Problem is, it doesn't run! I just get a blank screen. The main window never comes up!
Now before you ask...
I had this same problem with the iPhone SDK 3.x. I upgraded to the 4.x hoping it would be solved. It wasn't.
Yes the provisioning profile is installed. (Couldn't install the app if it wasn't.)
This same compiled app works fine on 3.x devices. Same with 4.x devices. Just not 2.x devices.
Again, no I am not using any post-2.x SDKs. 开发者_StackOverflow社区 To prove this I created a brand-new, window-based app from the 'New Project' dialog and the only changes I made was the background color of the window (to prove the XIB loaded) and I set the deployment target to 2.0 (It's still compiled against the 4.x SDK though.) Again, it runs fine on 3.x or 4.x devices, but just a black, blank screen on 2.x devices.
I've tried this on three separate 2.x devices included one freshly restored. I've used three separate dev machines (MacBook Pro with the 3.x SDK, MacBook Pro with the 4.x SDK and a Mac Pro with the 3.x SDK.) Same result every time.
I am stumped.
The fact that even an unmodified project doesn't run really has me confused. Could it be the XIB file? Did they change the format from 2.x to something newer in the 3.x SDK? If so, how do I set it back to 2.x. (Again, this is just a complete guess.) But I'm really stumped!
Have you checked the applicationDidFinishLaunching:options: call on your app delegate?
The options: parameter was added in 3.0 and is not present in any of my pre-3.0 code, although the earlier form still works.
The dictionary on options: is used to pass information to your app, such as 'was I started with a url from safari' etc.
If you expect to run on 2.0, you should probably change this back to the original 'applicationDidFinishLaunching:'.
2.x is completely deprecated for publishing to the app store. You should be able to install it on a device using a previous version of xCode, but that's about it. More info in my community wiki here:
Install xCode 3.2.3 w/ iPhone SDK 4, get "Base SDK missing", can't see other SDKs
Turns out Apple did make a breaking change (or more accurately, a 'fixing' change) that they didn't comment on. Specifically, our app wasn't explicitly setting the main window visible either via code or via the 'Show at launch' option in IB. BUT... in one version of the SDK, the runtime, seeing nothing set but needing to display something, it implicitly showed the window in the main XIB file. However, the newer (and older) SDKs (runtimes actually) didn't have this implicit behavior so when our code didn't explicitly show the window, we just got a blank screen.
So we simply checked the 'Show at launch' option in IB and it worked. Done and done!
精彩评论