简体   繁体   中英

Developing for iOS 4 with an iPhone 4S?

I made a mistake and decided to order a 4S instead of iPhone 4.

Is it possible to emulate iPhone 4 (iOS 4) in Xcode? I have only played around a little (Xcode 4.2) but so far I see only iPhone 5.0 Simulator, iPad 5.0 Simulator and something called iOS Device.

If I code using only things that are supposed to be available in iOS 4 or lower, but the whole time test using iPhone 5.0 simulator and/or a 4S device, is there a good chance the app will run without problems on an iPhone 4 / iOS 4 device? Of course I would test this before releasing the app, I'm just wondering how much of a problem it will be.

I wouldn't say buying an iPhone 4 was a "stupid mistake"... you're probably a bit more "future proofed" with a slightly younger design (an iPhone 4S may support iOS 7 or iOS 8 in a few years whereas Apple will decide to orphan iPhone 4's sooner than that).

If you have multiple SDK's installed, you should be able to see the iOS versions you can simulate under the "Hardware" menu and the "Version" submenu.

Right now, I only see iOS 5.0 available to my own simulator, whereas last week I could've sworn iOS 4.3 was available as an option for me as well. This probably changed when I updated my Xcode to the new version 4.3 a few days ago.

I'd recommend just sticking with iOS 5.0 for your simulator and device testing for now and by the time you actually release, most of your prospective customers will be off iOS 4.X at that point.

You can download the iOS 4.3 Simulator and debugging support from the Downloads section in Xcode preferences. You'll then be able to run on an iOS 4 simulator.

Backward compatibility is extremely difficult, and I wouldn't advise trying it without an actual device. There is definitely not a "good chance" that the app will run without problems on an earlier system. Earlier systems behave differently, and using any language the earlier system doesn't understand will crash your app, and Xcode will not warn you about this at any point during development.

It is possible to put an older SDK into the simulator SDK folder in Xcode 4.2 or earlier, so at least you can sort of simulate testing on an older system, but there is no substitute for testing on a device. But now that Xcode 4.3 has turned the SDK folder into part of a code-signed app bundle, that technique may be impossible going forward.

In the simulator, under the hardware drop down list, you can select the iOS version, either 4.3.2 or 5.0.

To your second question, no. There are methods and classes that are only available on iOS devices and you must test for them before attempting to use them. Testing on real devices is most valuable. Buy a used 3GS or 4 if you need to, but I would never release something that supports a platform that was not tested on that platform

Also check the iOS Deployment Target property of your XCode project.

在此输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM