美文网首页
OCLint再次实践:从simulator到真机

OCLint再次实践:从simulator到真机

作者: 十一岁的加重 | 来源:发表于2017-08-30 15:51 被阅读31次

多种方式接入,可参阅官方文档
http://docs.oclint.org/en/stable/guide/index.html

之前看的博客有点多,有点混,也不知道这下面的代码是哪里来的,不过真的能效果,能生成一个html来记录东西,关键使用起来很简单,就改两处,就行。

#!/bin/bash
myworkspace=???.xcworkspace # 替换workspace的名字
myscheme=??? # 替换scheme的名字
xcodebuild -workspace $myworkspace -scheme $myscheme clean&&
xcodebuild -workspace $myworkspace -scheme $myscheme \
-configuration Release -destination 'platform=iOS simulator,name=iPhone6' clean build\
| xcpretty -r json-compilation-database -o compile_commands.json&&
oclint-json-compilation-database -e Pods -- \
-report-type html -o oclint_result.html \
-rc LONG_LINE=200 \
-max-priority-1=100000 \
-max-priority-2=100000 \
-max-priority-3=100000; \
rm compile_commands.json;
if [ -f ./oclint_result.html ]; then echo '-----分析完毕-----'
else echo "-----分析失败-----"; fi

检验项目效果如下

image.png

你以为我写的代码很完美,其实上面是命令出错了,没检测出来,真实的情况是这样的

image.png

那么 问题来了,之前的命令是针对模拟器编译的
从这里我们可以看出来

'platform=iOS simulator,name=iPhone6'

那么问题来了,有些第三方是不支持模拟器编译的,所以哪怕用OCLint照样编译不了,也不用谈什么分析报告了,所以 问题就是怎么切换到真机,网上找了半天,一直没有,还是得靠自己

'platform=iOS,name=“mac”的 iPhone'

platform=处直接去掉simulator即可,至于后面的name是怎么来的
上图

image.png

相关文章

网友评论

      本文标题:OCLint再次实践:从simulator到真机

      本文链接:https://www.haomeiwen.com/subject/qxatjxtx.html