diff --git a/script/xcode_functions.sh b/script/xcode_functions.sh index e87697c90..c9e6980f6 100755 --- a/script/xcode_functions.sh +++ b/script/xcode_functions.sh @@ -14,13 +14,19 @@ function xcode_major_version () xcode_version | awk -F '.' '{ print $1 }' } -# Returns the latest iOS SDK version available -# via xcodebuild +# Returns the latest iOS SDK version available via xcodebuild. function ios_sdk_version () { - # This relies on the fact that the latest iPhone SDK - # is the last thing listed before the Xcode version. - /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep SDKVersion | tail -n 1 | awk '{ print $2 }' + # The grep command produces output like the following, singling out the + # SDKVersion of just the iPhone* SDKs: + # + # iPhoneOS9.0.sdk - iOS 9.0 (iphoneos9.0) + # SDKVersion: 9.0 + # -- + # iPhoneSimulator9.0.sdk - Simulator - iOS 9.0 (iphonesimulator9.0) + # SDKVersion: 9.0 + + /usr/bin/xcodebuild -version -sdk 2> /dev/null | grep -A 1 '^iPhone' | tail -n 1 | awk '{ print $2 }' } # Returns the path to the specified iOS SDK name