Marin
Marin

Reputation: 12910

Is it possible to compile Swift 2 code in Xcode 7 and run it on an iOS 11.1 iPhone 6?

I have an iphone 6 running ios 11.1

I have an old program that I need to run, and I tried to convert it to Swift 4 but wasn't translated properly (runtime errors mostly). Just want to run it and test it out. I do have xcode 8 and xcode 9 as well but since it's written in Swift 2.x I have to use either Xcode 8 or 7.

Running it in Xcode 7 I get

Could not find Developer Disk Image

Running it in Xcode 8 I get

This iPhone 6 is running iOS 11.1.1 (15B150), which may not be 
supported by this version of Xcode.

Is there a way to run this on a physical device or I must convert it ?

Upvotes: 3

Views: 111

Answers (2)

Yes you can do that. Install new Xcode version ( 9 ) and extract sdk image. Put it into your 7th folder, and you can run from Xcode 7 on iOS 11 device. But wonder, iOS 11 works only with 64x architecture, so apps should not be compiled in 32bit

Upvotes: 2

rmaddy
rmaddy

Reputation: 318824

Yes, you can run your Xcode 7/Swift 2 app on an iOS 11 device (assuming the app is built for 64-bit) but you can't run it (debug it) through Xcode. You would need to do an archive build then export the ipa for Ad-hoc deployment and install the app via iTunes.

Don't bother with any of that. Use Xcode 8 and use its conversion tool to migrate your code to Swift 3. Get all the compiler issues resolved. Then use Xcode 9 and to build and test your app on your iOS 11 device. Optionally you can (and probably should) also migrate to Swift 4.

Swift 2 is long dead. You need to migrate. The longer you wait, the harder it will be.

Upvotes: 4

Related Questions