2

I updated Xcode 7 and write some new code. The problem is that my app support iOS 7.1, that require run from Xcode 6.4 to run iOS 7.1 simulator. But I can not run the app from Xcode 6.4 any more, because there's some new coding syntax that is only run from Xcode 7. How can I debug my app for iOS 7.1. Thank you!

jscs
  • 63,694
  • 13
  • 151
  • 195
vietstone
  • 8,784
  • 16
  • 52
  • 79
  • You may need to reconsider supporting iOS 7.1 https://developer.apple.com/support/app-store/ – Desdenova Oct 01 '15 at 07:37
  • Most of the closely-related questions here indicate that you simply can't: [How can I run the iOS 7.1 simulator in Xcode 7.0 b2?](http://stackoverflow.com/q/31056634) [Can I debug my app on iOS 7 from Xcode 7?](http://stackoverflow.com/q/32363456) [How to install iOS 7 and onwards simulators in Xcode 7 beta 5?](http://stackoverflow.com/q/32137582) – jscs Oct 01 '15 at 07:43

2 Answers2

5
  1. Build your app in Xcode 7.

  2. Quit Xcode 7.

  3. Open up Xcode 6.4.

  4. Launch the Simulator.app from Xcode 6.4

  5. Run 'sudo xcode-select -s /path/to/Xcode-6.4.app'

  6. Run 'xcrun simctl install booted /path/to/the/built/simulator.app'

  7. Your app should be visible in the iOS 7.1 sim.

jscs
  • 63,694
  • 13
  • 151
  • 195
Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • Thanks for the info, but the question was "how to debug" )) I see that I can run the app in iOS 7.1 simulator from xcode 6.4, but can I attach xcode 7 debugger to the simulator then? – Mixaz Nov 14 '15 at 22:30
  • 1
    Yeah, just attach to the running process using the debugger just like you'd attach to any running process. – Jeremy Huddleston Sequoia Nov 14 '15 at 23:48
0

Xcode 7 doesn't have any code syntax. That's the iOS version. And If you are using any new API, your app will crash on lower versions.

Before using the newer API calls on existing framework objects, you may want to check respondsToSelector: on the object to avoid crashes. And you need to have a fallback method for lower API versions.

But if you are using iOS 9 only frameworks, Contacts framework for instance, you need to check the device's iOS version before using the framework to avoid crashes.

Desdenova
  • 5,326
  • 8
  • 37
  • 45
  • I checked all these new api while coding with Xcode 7.0. I mean, now I need to debug with iOS 7.1. If that, I need to build with Xcode 6.4. The problem is the app can not be built with Xcode 6.4 – vietstone Oct 01 '15 at 07:57
  • Sadly you need to find a device running iOS 7. You can't compile new code with Xcode 6. – Desdenova Oct 01 '15 at 07:59
  • "Xcode 7 doesn't have any code syntax. That's the iOS version" iOS itself _definitely_ doesn't have any "code syntax" -- in fact, it makes more sense to say that Xcode does, because it's the _compiler_ that allows usage of stuff like lightweight generics that OP's probably referring to (albeit sometimes with framework support, as with [collection literals](http://stackoverflow.com/questions/11425976/compiler-error-expected-method-not-found-when-using-subscript-on-nsarray)). – jscs Oct 01 '15 at 18:20