最近在研究infer时,遇到按照官方方法直接brew安装后cd 到项目目录,运行
> infer -- xcodebuild -target App目录 -configuration Debug -sdk iphonesimulator
后出现报错
(''')
Capturing in xcodebuild mode...
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
Internal Error: /usr/local/Cellar/infer/0.15.0/lib/infer/infer/bin/../lib/python/infer.py
-j 4 --project-root /Users/xxxxx/Desktop/other/test/test1 --out
/Users/xxxxxx/Desktop/other/test/test1/infer-out -- xcodebuild
-target test1 -configuration Debug -sdk iphonesimulator:
exited with code 1
(''')
Error backtrace:
Raised at file "base/Die.ml" (inlined), line 25, characters 6-36
Called from file "base/Logging.ml", line 314, characters 58-80
Called from file "integration/Driver.ml", line 159, characters 2-16
Called from file "integration/Driver.ml", line 280, characters 6-420
Called from file "infer.ml", line 20, characters 2-36
Called from file "infer.ml", line 130, characters 8-54
Run the command again with `--keep-going` to try and ignore this error.
(''')
网上找到的解决方法如下
(''')
1. 执行运行脚本的命令:报错如下“
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
”
2. 执行“
xcodebuild -showsdks
”,报错如下“
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
”
3. 执行“
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer/
”切换到当前Xcode路径下
4. 执行"
xcodebuild -showsdks
":
5. 执行"
xcrun --sdk iphoneos --show-sdk-path
"
结果“
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk
”
6. 运行脚本命令成功