xcode 使用新的 Sierra 更新缓慢的应用程序编译
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40257968/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Slow app compilation with new Sierra update
提问by psu
When I updated my mac to macOS Sierra 10.12.1 time of running application on real device significantly increased. "Run custom script 'Embed Pods Frameworks'" and "Copy Swift standard libraries" take more then 30 minutes to build.
当我将我的 mac 更新到 macOS Sierra 10.12.1 时,在真实设备上运行应用程序的时间显着增加。“运行自定义脚本‘嵌入 Pods 框架’”和“复制 Swift 标准库”需要超过 30 分钟来构建。
Do someone face the same issue?
有人面临同样的问题吗?
回答by Troy
Check your keychain. After updating to Sierra to 10.12.1, I had over 500 copies one of my certificates, and a few others were duplicated a few hundred times.
检查您的钥匙串。更新到 Sierra 到 10.12.1 后,我的其中一个证书复制了 500 多份,而其他一些则复制了数百次。
I removed all the duplicates and kept just one of each, and my code signing time went from 30 seconds per framework down to about 1 second per.
我删除了所有重复项并只保留了一个,我的代码签名时间从每个框架 30 秒减少到每个框架大约 1 秒。
I don't know how or why the certificates were duplicated, but the timing of the issue suggests it was due to updating Sierra.
我不知道证书是如何或为什么被复制的,但问题发生的时间表明这是由于更新 Sierra。
回答by Johnny
2017-03-23 Update
2017-03-23 更新
You can skip installing the beta version of CocoaPods, because the COCOAPODS_PARALLEL_CODE_SIGN
flag is also evaluated in the current release build.
您可以跳过安装 CocoaPods 的测试版,因为该COCOAPODS_PARALLEL_CODE_SIGN
标志也在当前发布版本中评估。
Original Answer
原答案
Found an alternative solution, not best, but at least it's speeding up. It works (for me)
找到了一个替代解决方案,不是最好的,但至少它正在加速。这个对我有用)
Cocoapods released a new beta version few days ago.
Cocoapods 几天前发布了一个新的测试版。
Which allows parallel code signing when running the embed framework script (https://github.com/CocoaPods/CocoaPods/pull/6088#issuecomment-257441733)
在运行嵌入框架脚本时允许并行代码签名 ( https://github.com/CocoaPods/CocoaPods/pull/6088#issuecomment-257441733)
- Install the latest beta version
- 安装最新的测试版
gem install cocoapods --pre
gem install cocoapods --pre
- Go to your Xcode target build settings and click the
+
icon at the top
- 转到您的 Xcode 目标构建设置并单击
+
顶部的图标
- Set
COCOAPODS_PARALLEL_CODE_SIGN
totrue
- 设置
COCOAPODS_PARALLEL_CODE_SIGN
为true
And enjoy the increased building speed!
并享受提高的建造速度!
回答by Max Potapov
If keychain looks good, but problems exists – check the preferences and remove all duplicates in this file:
~/Library/Preferences/com.apple.security.plist
如果钥匙串看起来不错,但存在问题 - 检查首选项并删除此文件中的所有重复项:
~/Library/Preferences/com.apple.security.plist
For typical setup this file must contain only one record with login keychain reference.
对于典型设置,此文件必须仅包含一个带有登录钥匙串参考的记录。
回答by Sven Driemecker
All the above mentioned approaches didn't work for me. What helped a lot was resetting the System.keychain
, which had 25 MB size. This speeded up build times up to 40% on our CI system.
上面提到的所有方法对我都不起作用。有很大帮助的是resetting the System.keychain
,它有 25 MB 大小。这将我们的 CI 系统的构建时间加快了 40%。
Analyze
分析
du -h /Library/Keychains/System.keychain
good: 60K
bad: 25MB
Reset
重启
sudo systemkeychain -vfcC [password]
Attention: If you have important keys/certs/passwords stored in your System.keychain, you may want to export them before performing the reset and then reimport them on demand. This wasn't necessary for me. My new System.keychain has no content and building projects works absolutely fine.
注意:如果您的 System.keychain 中存储了重要的密钥/证书/密码,您可能需要在执行重置之前导出它们,然后根据需要重新导入它们。这对我来说没有必要。我的新 System.keychain 没有内容,构建项目绝对正常。