I'm doing an iOS app project in Swift 1.2, using Cocoapods 0.37.2, Xcode 6.3.2. After adding around 8 pods in my project, app launch time greatly increases (around 10 seconds more) on device (iPhone 5). (Note: launch time means the time when you tap the app icon to open the app)
It is so slow iOS terminates it because it doesn't launch in time. The top of the crash log is as follows...
Application Specific Information: com.tryslowappswift failed to launch in time
Elapsed total CPU time (seconds): 27.720 (user 27.720, system 0.000), 68% CPU
Elapsed application CPU time (seconds): 0.074, 0% CPU
Thread 0:
0 dyld 0x1ff0f4c8 ImageLoaderMachOCompressed::rebase(ImageLoader::LinkContext const&) + 456
1 dyld 0x1ff087be ImageLoader::recursiveRebase(ImageLoader::LinkContext const&) + 174
2 dyld 0x1ff07dca ImageLoader::link(ImageLoader::LinkContext const&, bool, bool, bool, ImageLoader::RPathChain const&) + 186
3 dyld 0x1ff012fc dyld::link(ImageLoader*, bool, bool, ImageLoader::RPathChain const&) + 204
4 dyld 0x1ff022d6 dyld::_main(macho_header const*, unsigned long, int, char const**, char const**, char const**, unsigned long*) + 2362
5 dyld 0x1fefe222 dyldbootstrap::start(macho_header const*, int, char const**, long, macho_header const*, unsigned long*) + 394
6 dyld 0x1fefe03c _dyld_start + 60
No thread state (register information) available
...
You can test this by:
Note: I have created an example Swift project with all the pods setup in my github repo. You can just clone and run it on your device and see the delay for yourself.
- Create a new blank project, nothing in the
application:didFinishLaunchingWithOptions:method - Run the app on device and see the app launch very fast.
- Stop. Now try adding a
Podfilewith about 8 pods (no matter big or small the pods are), dopod install. - Just for clarity, this is the
PodfileI used...
Podfile
source 'http://ift.tt/1czpBWo'
platform :ios, '8.0'
use_frameworks! # required for Swift pods
pod 'Alamofire', '~> 1.2.1'
pod 'NPReachability', '~> 0.2.0'
pod 'ActionSheetPicker-3.0', '~> 1.6.1'
pod 'SDWebImage', '~> 3.7.2'
pod 'KVNProgress', '~> 2.2.1'
pod 'KeychainAccess'
pod 'JazzHands', '~> 0.2.1'
pod 'DGActivityIndicatorView'
- Then run on device again. This time you will notice the 10+ seconds delay, even before
application:didFinishLaunchingWithOptions:method is called. Noimport, no bridging header files, just install the pod into the project and it slows down the launch (-- rage guy meme !!! ---)
I suspect this has to do with Swift 1.2 so I tried on a Objective-C project, but I still experience the same delay. It seems to happen right after a normal pod installation, I have no idea how I can optimize or fix this. :(
Aucun commentaire:
Enregistrer un commentaire