1. 程式人生 > 其它 >SDK “iphoneos“ cannot be located

SDK “iphoneos“ cannot be located

技術標籤:react nativexcode

SDK "iphoneos" cannot be located


React Native 初始化的時候報如下錯誤

xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'

那是我們Xcode的命令列版本選擇有問題。Xcode 內建 CommandLineTools ,所帶的工具也是非常的完美。Apple 還將 CommandLineTools 從 Xcode 剝離出來,供大家使用。通過xcode-select --print-path命令得到路徑就是單獨安裝CommandLineTools工具的預設路徑

/Library/Developer/CommandLineTools

所以我們要重新指定xcode的命令列版本
輸入
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
即可解決問題。