Cocoapods `Embed pod frameworks` took long time to

2020-05-24 07:17发布

问题:

Environment:

  • Macbook Pro With Retina Display 2013 late with 8G Ram, 256GB ssd.
  • Cocoapods 1.1.1
  • macOS Sierra 10.12.1
  • Xcode 8.0
  • iPhone 6s

Installed Pods

inhibit_all_warnings!
use_frameworks!

def import_common_pods
    pod 'AFNetworking', '~> 2.6.3'
    pod 'GoogleAnalytics', '~> 3'
    pod 'SVProgressHUD', '~> 1.1.3'
    pod 'CocoaLumberjack', '~> 2.3.0'
    pod 'SVWebViewController', '~> 1.0'
    pod 'Crashlytics', '~> 3'
end

def import_project_common_pods
  pod 'FDFullscreenPopGesture', '1.1'
  pod 'ImagePicker', :git => 'git@github.com:hyperoslo/ImagePicker.git'
  pod 'Mixpanel', '~> 3.0.4'
  pod "YoutubePlayer-in-WKWebView", "~> 0.2.0"
  pod 'UICollectionViewLeftAlignedLayout'
  pod 'Firebase', '~> 3'
  pod 'Firebase/RemoteConfig', '~> 3'
  pod 'Firebase/AppIndexing', '~> 3'
  pod 'Firebase/Messaging', '~> 3'
  pod 'MWPhotoBrowser', '~> 2.1.2'
  pod 'AppsFlyerFramework'
  pod 'pop', '~> 1.0.9'
  pod 'UICountingLabel'
  pod 'Ono', '~> 1.2.2'
  pod 'DateTools'
  pod 'GoogleIDFASupport', '~> 3.14.0'
  pod 'M13ProgressSuite', '~> 1.2.8'
  pod 'YYText', '~> 1.0'
  pod 'mopub-ios-sdk', '~> 4'
  pod 'KVOController', '~> 1.1.0'
  pod 'Fabric', '~> 1.6'
  pod 'JazzHands', '~> 2.0.8'
  pod 'DeviceUtil'
  pod 'Flurry-iOS-SDK', '~> 7'
  pod 'FBSDKCoreKit', '~> 4'
  pod 'SDWebImage', '~> 3.8.1'
  pod 'TTTAttributedLabel', '~> 2.0.0'
  pod 'IQKeyboardManager', '~> 4.0'
  pod 'MZFormSheetController'
  pod 'Masonry', '~> 1.0.1'
  pod 'DZNEmptyDataSet', '~> 1.8.1'
  pod 'JSQSystemSoundPlayer', '~> 4'
  pod 'HMSegmentedControl', '~> 1.5.2'
  pod 'RNCryptor', '~> 3.0.1'
  pod 'FBSDKShareKit', '~> 4'
  pod 'FBSDKLoginKit', '~> 4'
  pod 'SZTextView'
  pod 'UIScrollView-InfiniteScroll', '~> 0.7.3'
  pod 'FLAnimatedImage', '~> 1.0'
  pod 'Socket.IO-Client-Swift', '~> 8.0.2'
end

target 'MyProject' do
    import_common_pods
    import_project_common_pods
end

There is a run script of Cocoapods called [CP] Copy Pods Resources

Recently I found out this run script is killing my build time, when building the App to real device,

it spend almost 1~2 minutes to finish the whole run script.

But when building on the simulator, the run script finished in like 10 seconds.

It usually works fine when building to real device,

but I don't know why the time of executing run script increased crazily recently, I could almost have a cup of coffee!

I've found this post on Stackoverflow: IOS Run custom shell script 'embed pods framework' file not found error but it doesn't helps.

And also tried checking the Run Script Only When Installing for the run script. But the Xcode shows an error message:

App installation failed no code signature

So neither this solution works for me...

Anybody facing the same issue? Thanks

回答1:

If you use the new beta of Cocoapods - 1.2.1.beta.1 at the time of writing, which you can install sudo pod install --pre then you have access to the super cool COCOAPODS_PARALLEL_CODE_SIGN option.

This has sped up the Embed Pods Frameworks build stage for me by 75% on device.

Instructions in below image.



回答2:

I have the same issue since I installed Xcode 8.1 beta and created a new Swift project. Currently I "fixed" the issue by unchecking the "Run script only when installing" the first time (causing a longer build time), for every following build I am able to build and run the app with the checkbox "Run script only when installing" checked. This works until I do a "pod install" or "pod update". I am eagerly waiting for an official update to Xcode 8.1, but perhaps it has something to do with cocoapods itself?