Search code examples
ioscocoapodsfastlanexcode14

Fastlane with XCode 14: ARCHIVE FAILED


My current version of Fastlane 2.173.0 works OK with XCode 13 and builds and publishes my iOS RN/Native project to TestFlight. But after moving to XCode 14 I have got next error on start building (gym).

[16:56:49]: $ set -o pipefail && xcodebuild -workspace MyProject.xcworkspace -scheme MyProject -configuration Release -destination 'generic/platform=iOS' -archivePath /Users/vagrant/Library/Developer/Xcode/Archives/2022-10-31/MyProject\ 2022-10-31\ 16.56.49.xcarchive archive | tee /var/folders/9l/1ysg9vq51p37q0lgksxhdb9r0000gn/T/fastlane_logs3640665801/gym/MyProject-MyProject.log | xcbeautify
[16:56:52]: ▸ Resolve Package Graph
[16:56:54]: ▸ Resolved source packages
[16:56:54]: ▸ DLog - https://github.com/ikhvorost/DLog @ 1.4.0
[16:56:54]: ▸ PromiseQ - https://github.com/ikhvorost/PromiseQ.git @ 1.7.0
[16:56:54]: ▸ Realm - https://github.com/realm/realm-cocoa.git @ 10.15.1
[16:56:54]: ▸ RealmDatabase - https://github.com/realm/realm-core @ 11.4.1
[16:57:10]: ▸ ⚠️ Run script build phase 'Bundle Settings File' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Embed Frameworks' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ⚠️ Run script build phase '[CP-User] [RNFB] Core Configuration' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'MyProject' from project 'MyProject')
[16:57:10]: ▸ ** ARCHIVE FAILED **

gym fails immediately after start from the above log. I've tied to upgrade Fastlane, Ruby, Cocoapods to the latest versions but it doesn't help and I'm still observing the failure.

I need to use new iOS SDK from XCode 14 for new features so how to fix "ARCHIVE FAILED" issue?


Solution

  • Xcode 14 strictly checks your project and distribution settings, "Development Team" and Bitcode for pods etc. from the one side, and maybe has some bugs from the other.

    You should make next changes to avoid the issue:

    1. Remove Mac Catalyst from the destinations (if you don't use it) in your project:

    General > Supported Destinations

    enter image description here

    1. Disabling signing, bitcode and Mac Catalyst for all your pods in Podfile:
    post_install do |installer|
      react_native_post_install(installer)
      __apply_Xcode_12_5_M1_post_install_workaround(installer)
      flipper_post_install(installer)
      
      # Xcode 14 fix
      installer.generated_projects.each do |project|
        project.targets.each do |target|
          target.build_configurations.each do |config|
            config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
            config.build_settings['ENABLE_BITCODE'] = 'NO'
          
            config.build_settings['SUPPORTED_PLATFORMS'] = 'iphoneos iphonesimulator'
            config.build_settings['SUPPORTS_MACCATALYST'] = 'NO'
            config.build_settings['SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD'] = 'NO'
          end
        end
      end
    end
    
    1. Update Fastlane to 2.210.1 because it has fix for deliver and pilot.