19

I‘m using Xcode 11 GM 2 to archive my app. It uses CocoaPods and Swift. When trying to archive my app, it infinitely gets stuck here: error This still happens after removing Firebase or other frameworks. Any ideas on how to resolve this?

rmaddy
  • 314,917
  • 42
  • 532
  • 579
thatmarcel
  • 388
  • 3
  • 15
  • Is it working with latest Xcode 10 or it's an Xcode 11 specific problem? – balazs630 Sep 21 '19 at 15:47
  • @balazs630 I can't test because the app is built with iOS 13 specific features so building in Xcode 10 fails – thatmarcel Sep 21 '19 at 20:22
  • @SergStav I‘m on macOS Mojave and I didn‘t get that project to archive. I created a new project without CocoaPods though, copied the source code, used Carthage instead, switched to the legacy build system (File > Project Settings), then got it stuck on „Setting mode for 1 of 1 files“, deleted Derived Data, did a clean (Command + K (+Shift)) and it did archive. (I also had an issue with RMessage, which had a „Frameworks“ folder nested in it which contained another framework, that folder needed to be deleted, also check for large dictionaries in frameworks, try to remove or split them) – thatmarcel Sep 23 '19 at 21:10
  • 1
    @thatmarcel what exactly solved your issue I'm having the same issue on Xcode 11.5 Catalina after adding the firebase Crashlytics run script in build phases it the archives never ends – iMinion Jun 17 '20 at 11:31
  • i am also facing the same issue on XCode 12.1, did anyone manage to fix this issue? – Aman.Samghani Nov 13 '20 at 10:15

2 Answers2

30

This could help (I was having an issue with SwiftSoup, another CocoaPod). I was experiencing inexplicable hangs while trying to get Xcode 11 to archive my app (even at the command line). This is not meant to be a permanent fix, but rather a temporary workaround (in other words, we shouldn't have to do this to get a problematic library to build)!

Add this to the bottom of your Podfile and re-run pod install.

post_install do |installer|
  installer.pods_project.targets.each do |target|
    next unless target.name == '<NAME OF POD>'
    target.build_configurations.each do |config|
      next unless config.name.start_with?('Release')
      config.build_settings['SWIFT_OPTIMIZATION_LEVEL'] = '-Onone'
    end
  end
end

Then try to archive your project. If that doesn't work… perhaps try messing around with other compiler optimization settings?

Ben Kreeger
  • 6,355
  • 2
  • 38
  • 53
  • 3
    I was using SwiftSoup and that solution worked for me as well. Thanks! – Engnyl Sep 26 '19 at 15:18
  • 2
    @BenKreeger Thanks for your work around (with the target name fixed!). It apparently works for some people, but not for me. I have also directly turned off the Swift Optimization flag in the Project settings. I am using Xcode 11 release and SwiftSoup 2.2.1 and the Archive process still hangs while linking SwiftSoup right after the "touch". Any thoughts?? – BlueskyMed Oct 02 '19 at 13:45
  • 1
    I had SwiftSoup too. this solution worked for me too. – Sandeep Rana Oct 04 '19 at 04:57
  • Swap the *config.name* from `Release` to `Alpha` if you need to upload the build to Fabric Crashlytics. That was my case a well! – kalafun Oct 09 '19 at 08:56
  • Am stuck my own project. how can i find the issue? – Karthick C Oct 10 '19 at 09:53
  • Yes, seems like SwiftSoup was the issue. I re-generated the project with Carthage and it still woudn't compile until I removed SwiftSoup – thatmarcel Oct 11 '19 at 19:23
  • THANK YOU... that fixed it - SwiftSoup was the culprit in my case as well – Jc Nolan Oct 25 '19 at 02:55
  • SwiftSoup had a code optimization which exposed a compiler bug. For a brief time, the fix was to use a non standard tool chain, but eventually the Swift compiler was fixed and using the current compiler tool chain in Xcode (I believe since 11.4) is the correct answer. – BlueskyMed Jun 18 '20 at 13:49
9

I have found a clean and quick solution in the meantime, click "Pods" in the project navigator, then in targets (picture) set SwiftSoup,

enter image description here

In Swift compiler set both -Onone. Now try to archive.

enter image description here

Tinyfool
  • 1,460
  • 2
  • 18
  • 40
aph340
  • 109
  • 4
  • 1
    I was using SwiftSoup and this fix my problem. Xcode was listing other pods like Alamofire or some Firebase pod, but after remove SwiftSoup optimisation, I manager to archive – Elano Vasconcelos Oct 23 '19 at 14:17