IOS – Compile for iOS 5.1 in macOS Mojave

developmentiosxcode

I have a macOS Mojave based Mac, and, for a project, I need to be able to target iOS 5.1 (iPad 1).

Xcode 10 doesn't ship build support for iOS 5.1, so I downloaded Xcode 4.3 from Apple's archives.

Xcode 4.3 isn't compatible with macOS Mojave, and from what I've been able to understand, it is with OS X Mountain Lion.

Without having to buy an old Mac (old enough to be based on OS X Mountain Lion), and without having to completely reinstall the OS, how can I compile for the iOS target 5.1, for an iPad 1?

Best Answer

The latest Xcode version that is documented by Apple to include the iOS 5 SDK is Xcode 4.3.3 for Lion. Apple doesn't document in the release notes whether it is also included in Xcode 4.4 and Xcode 4.4.1. However, by Xcode 4.5 it is definitely not included anymore.

The important thing to notice here is that you actually do not need to have the iOS 5 SDK in order to build an app for iOS 5. This means that you can build apps for iOS 5 with an Xcode that is newer, and doesn't as such include the iOS 5 SDK.

You do this by setting the deployment target of your project. Inside Xcode you click on your project (the blueprint icon), select the Info tab and then you have a drop-down named "iOS Deployment Target". You'll want to set it to 5.1.

With modern Xcode releases, you can download simulators, etc. directly from within the latest Xcode - however this only goes back to iOS 8 for Xcode 10. This also goes for the deployment target.

The end result is that you can use a much newer Xcode than Xcode 4.3, although not the latest Xcode 10 releases. You just need to remember to set your deployment target for the project!