简体   繁体   中英

XCode 8.0 app building ultraslow

Problem is that when building a Swift app in XCode 8, the source files are compiled quickly , but Copying Swift standard libraries takes the cake - the phase could run for several minutes (usually the whole build is around 4-5 minutes, worst cases have been generously over 10 minutes – used to be under a minute).

Additionally, the signing phase of archive's export is painfully slow, sometimes taking close to half an hour (again, used to be quite quick).

I've scoured the web for answers for days, reinstalled XCode countless times, tried new Swift toolchains, experimented with turning on/off Sierra's iCloud Drive (the derived folder still needs to be hidden from it), tried every build setting that anyone, and their mother, has recommended, made numerous new blank projects, and lost all hope...

So my question is, how can i make it normal ?

EDIT: I also have 867 Apple ID keys (same amount of pub-s and priv-s, and the accompanying certificates) in my Mac's Keychain – is there a chance this issue is related to it? Takes a ton of time to go through them and find the correct one to sign with?

So... i finally snapped and deleted all my Apple ID keys (except 1 key pair ) from my Keychain (was terrified about breaking things). Now everything builds quickly / normally and i can finally be happy again...

Just to reiterate – make sure you don't have duplicate keys in Keychain .

Go to project settings, then Editor > Add Build Setting > Add User-Defined Setting, and add the following:

SWIFT_WHOLE_MODULE_OPTIMIZATION = YES

Adding this flag dropped our clean-build compile times from 7 mins to 65s for a 40KLOC swift project, miraculously. Also can confirm 2 friends have seen similar improvements on enterprise projects.

I can only assume this is some kind of bug in Xcode 8.0## Heading ##

Besides removing the duplicated keys, I notice a huge improvement in codesign when I changed the access control of the xcode keys to "Allow all applications to access this item"

open "Keychain Access", select the "Keys", and double tap on each key. on the "Access Control" tab you will have the option to select "Allow all applications to access this item".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM