1. 程式人生 > 資訊 >蘋果確認部分 iPhone 13 存在 Bug,從備份恢復可能導致一系列問題

蘋果確認部分 iPhone 13 存在 Bug,從備份恢復可能導致一系列問題

Xcode相關的路徑

  • Provisioning Profiles存放路徑:~/Library/MobileDevice/Provisioning Profiles
  • 所有模擬器(包括歷史模擬器):~/Library/Developer/CoreSimulator/Devices

清理Xcode佔用容量

  • iOS DeviceSupport:~/Library/Developer/Xcode/iOS DeviceSupport
    說明:在連線裝置除錯時,會自動在該路徑下生成該裝置系統版本的Symbols目錄,其中含有系統動態庫,比如動態庫UIKit的路徑為~/Library/Developer/Xcode/iOS DeviceSupport/11.4 (15F79)/Symbols/System/Library/Frameworks/UIKit.framework/UIKit
    建議:保留經常除錯的裝置的iOS系統版本,不經常使用的系統版本都刪掉。
  • Archives:~/Library/Developer/Xcode/Archives
    說明:打包生成的Archives檔案,這個不可恢復,刪除後Archives的檔案都會消失。
    建議:保留有效的打包檔案,備份dSYM檔案。
  • DerivedData:~/Library/Developer/Xcode/DerivedData
    說明:執行專案工程產生的快取,刪除資料夾中的內容會刪除build生成的專案索引、build輸出以及日誌,重新開啟專案時會重新生成。
    建議:全部刪除,之後執行程式的時候會重新生成的。

真機除錯

  • 真機包存放路徑:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport,一個真機包帶有兩個檔案:DeveloperDiskImage.dmg.signature和DeveloperDiskImage.dmg
  • github上收集的真機包:iPhoneOSDeviceSupport(或者iOS-DeviceSupport),往路徑新增完真機包後,記得關閉Xcode,然後重新啟動Xcode執行專案
  • 每個版本的Xcode都帶有適應當時最新iOS系統的SDK,iPhone SDK存放路徑:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk
    github上收集的iOS系統的SDK:iPhoneOS.sdk

TARGETS Build Settings

  • Library Search Paths:設定靜態庫(比如.a、私有的.framework)或動態庫(.dylib)的路徑。
    如果報"directory not found for option '-L/..."錯誤,說明Library Search Paths沒有配置好。
  • Header Search Paths:設定靜態庫或動態庫的標頭檔案(即.h檔案)的路徑。
    如果專案是用cocoaPods管理第三方庫,比如專案中使用了AFNetworking庫,cocoaPods會自動配置好AFNetworking庫的標頭檔案路徑,不需要開發者區手動配置,路徑內容為:
$(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/AFNetworking"

但如果是使用非cocaPods管理的庫(比如自己編譯的.a檔案),就需要手動配置庫的標頭檔案的路徑,比如路徑內容為:

$(SRCROOT)/pjproject/pjlib/include $(SRCROOT)/pjproject/pjlib-util/include

否則會報找不到標頭檔案的錯誤(一般會在#include <>地方報錯)

Xcode命令

  • 檢視Xcode支援的SDKs版本命令(包括iOS、iOS Simulator、macOS、tvOS):xcodebuild -showsdks
  • 檢視當前使用Xcode版本路徑:xcode-select -p
  • 更改當前使用Xcode版本路徑:sudo xcode-select -s /Applications/Xcode9.app/Contents/Developer

Xcode執行問題

  • 若Xcode勾選了自動管理簽名(automatically manage signing)且更改過Signing & Capabilities,則Xcode會自動在該路徑下生成對應的描述檔案,可通過建立時間和內容來檢視描述檔案對應的Bundle Identifier、App ID等資訊。
    如果鑰匙串有可用的證書,但Signing & Capabilities卻爆紅,Command+R遇到錯誤"Your account already has a signing certificate for this machine but it is not present in your keychain" 或 "no identity found Command CodeSign failed with a nonzero exit code",可能是Xcode抽風了,完全退出Xcode,重新開啟專案,Xcode會在~/Library/MobileDevice/Provisioning Profiles路徑下生成描述檔案,且能正常連結上鑰匙串中的證書了。