Fix build for Xcode 7.0 beta 5.
This beta has added (or at least rearranged) the SDKs to include WatchOS. This results in SDK_IOS_VERSION finding the WatchOS version number (2.0) instead of the iOS SDK version number. Fix this by rewriting the lines that handle xcodebuild to use different logic that is more robust. Tested on Xcode 6.4 and Xcode 7.0 beta 5.merge-experiment
Reference in new issue