一. iOS Deployment Target 支援iOS7.0以下低版本
蘋果釋出Xcode8.0之後的版本,選擇iOS的最低版本(iOS Deployment Target)隻有iOS 8.0及以上的選項,但是現在絕大部分App仍需要相容iOS8.0以下的版本;針對這種情況,Xcode可以通過手動配置iOS7.0及其以下的版本;配置的步驟如下:
1.打開版本所在Xcode中的路徑
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport
2.把你所需要支援的低版本拷貝到該路徑下
3.相關準備工作完成後,接下來就是配置你所需要支援的低版本:
-
打開路徑:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk;
注意:你可能無權修改該目錄,需要增加對此目錄的讀和寫的權限;操作流程:輕按兩下該目錄下的“空白”區域->彈出選項框->點選顯示簡介->彈出簡介框-> 選中讀和寫的權限
- 打開SDKSettings.plist檔案,添加低版本的如圖所示; 注意:此檔案也需要修改權限設定,如上步驟。
- 重新開機電腦即可
二. Base SDK 配置低版本iOS SDK運作環境
1 啟動Xcode ,打開Xcode->Preferences->Components ,下載下傳需要的版本。
2 打開~/Library/Caches/com.apple.dt.Xcode/Downloads 目錄,可看到所下載下傳的 iPhoneSimulator SDK
3 輕按兩下 iPhoneSimulator SDK,進行安裝。
4 新版Xcode 6以後模拟器會被安裝到這個目錄下:
~/Library/Developer/CoreSimulator/Profiles/Runtimes/
5 低版本模拟器環境安裝好之後,把相應的SDK拷貝的最新的Xcode的對應位置:
e.g.:
/Applications/Xcode7.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk
/Applications/Xcode7.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneOS9.1.sdk
分别拷貝到
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.1.sdk
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneOS9.1.sdk
6 修改配置資訊
真機的SDK路徑:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Info.plist
模拟器SDK路徑:
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Info.plist
改變MinimumSDKVersion的值,重新開機Xcode會識别大于等于MinimumSDKVersion的所有SDK。
7.檢視Build Settings 中的Base SDK選項