1

I'm trying to compile my app as I used to do, but it's returning this error:

** ARCHIVE FAILED **

The following build commands failed:
  CompileC /Users/myuser/Library/Developer/Xcode/DerivedData/myapp-gcpsxwgciwwqcxghqjubozbsahac/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/Pods.build/Debug-iphoneos/GoogleDataTransport.build/Objects-normal/arm64/GDTCORPlatform.o /Users/myuser/dev/myapp-ionic/platforms/ios/Pods/GoogleDataTransport/GoogleDataTransport/GDTCORLibrary/GDTCORPlatform.m normal arm64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'GoogleDataTransport' from project 'Pods')
(1 failure)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.

        cordova build ios exited with exit code 65.

        Re-running this command with the --verbose flag may provide more information.

What I tried so far:

  • remove and add cordova ios platform @ 5.1.1
  • ionic repair several times
  • pod deintegrate && pod install

My package.json has

"@ionic-native/firebase-x": "^5.36.0",
"@ionic/angular": "^4.7.1",
"cordova-plugin-androidx": "^1.0.2",
"cordova-plugin-androidx-adapter": "^1.1.0",
"cordova-plugin-firebase": "^2.0.5",
"cordova-plugin-firebasex": "^7.0.1",
...
"cordova-plugin-googlemaps": "^2.7.1",
"cordova-plugin-googlemaps-sdk": "git+https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git",
"phonegap-plugin-barcodescanner": "^8.1.0",
...
"cordova": {
  "plugins": {
    "cordova-plugin-whitelist": {},
    "cordova-plugin-statusbar": {},
    "cordova-plugin-device": {},
    "cordova-plugin-splashscreen": {},
    "cordova-plugin-ionic-keyboard": {},
    "cordova-plugin-app-version": {},
    "cordova-plugin-network-information": {},
    "cordova-plugin-screen-orientation": {},
    "cordova.plugins.diagnostic": {
      "ANDROID_SUPPORT_VERSION": "28.+"
    },
    "cordova-plugin-badge": {},
    "cordova-plugin-firebasex": {
      "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
      "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
      "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
      "ANDROID_ICON_ACCENT": "#FF00FFFF",
      "ANDROID_PLAY_SERVICES_TAGMANAGER_VERSION": "17.0.0",
      "ANDROID_FIREBASE_ANALYTICS_VERSION": "17.2.1",
      "ANDROID_FIREBASE_MESSAGING_VERSION": "20.0.0",
      "ANDROID_FIREBASE_CONFIG_VERSION": "19.0.3",
      "ANDROID_FIREBASE_PERF_VERSION": "19.0.1",
      "ANDROID_FIREBASE_AUTH_VERSION": "19.1.0",
      "ANDROID_CRASHLYTICS_VERSION": "2.10.1",
      "ANDROID_CRASHLYTICS_NDK_VERSION": "2.1.1"
    },
    "cordova-plugin-androidx-adapter": {},
    "cordova-plugin-apprate": {
      "PLAY_CORE_VERSION": "1.+"
    },
    "uk.co.workingedge.phonegap.plugin.launchnavigator": {
      "GOOGLE_API_KEY_FOR_ANDROID": "xxxxxxxxxxxxxx",
      "OKHTTP_VERSION": "3.12.0",
    },
    "cordova-plugin-androidx": {},
    "cordova-plugin-inappbrowser": {},
    "cordova-clipboard": {},
    "cordova-plugin-geolocation": {
      "GPS_REQUIRED": "true"
    },
    "phonegap-plugin-barcodescanner": {
      "ANDROID_SUPPORT_V4_VERSION": "27.+"
    },
    "cordova-plugin-googlemaps": {
    },
    "cordova-plugin-ionic-webview": {}
  },
  "platforms": [
    "ios"
  ]
}

My ionic info

Ionic:

   Ionic CLI                     : 6.20.8 (/Users/myuser/.nvm/versions/node/v14.19.1/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 4.11.13
   @angular-devkit/build-angular : 0.803.29
   @angular-devkit/schematics    : 8.1.3
   @angular/cli                  : 8.1.3
   @ionic/angular-toolkit        : 2.3.3

Cordova:

   Cordova CLI       : 11.1.0
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 20 other plugins)

Utility:

   cordova-res                          : 0.15.4
   native-run (update available: 1.7.2) : 1.7.1

System:

   Android SDK Tools : 26.1.1 (/Users/myuser/Library/Android/sdk)
   ios-deploy        : 1.12.1
   ios-sim           : 8.0.2
   NodeJS            : v14.19.1 (/Users/myuser/.nvm/versions/node/v14.19.1/bin/node)
   npm               : 6.14.17
   OS                : macOS
   Xcode             : Xcode 14.3 Build version 14E222b

My Podfile

source 'https://cdn.cocoapods.org/'
platform :ios, '11.0'
use_frameworks!
target 'MyApp' do
  project 'MyApp.xcodeproj'
  pod 'Firebase/Core', '6.13.0'
  pod 'Firebase/Auth', '6.13.0'
  pod 'Firebase/Messaging', '6.13.0'
  pod 'Firebase/Performance', '6.13.0'
  pod 'Firebase/RemoteConfig', '6.13.0'
  pod 'Fabric', '1.10.2'
  pod 'Crashlytics', '3.14.0'
end

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
end
anderlaini
  • 1,593
  • 2
  • 24
  • 39
  • 1
    Hi, did you find a fix for this? I'm having the same issue when updating to Xcode 14.3 (from Xcode 13). – amcastror Apr 21 '23 at 18:10
  • @amcastror Yes! Added my current build flow as answer to this post. Hope it helps! – anderlaini Apr 21 '23 at 19:23
  • 1
    I ended up downgrading Xcode to 14.1 and it worked (posted the answer as an alternative to yours). Thanks a lot for sharing your solution. – amcastror Apr 21 '23 at 19:33

2 Answers2

1

After lots of research I can build my app.

Had a lot of problems so I'm not sure which exactly was the solution, but here is my current build process.

Use node v18 + Xcode 14.2 (download previous version on the web)

Run in console

export NODE_OPTIONS=--openssl-legacy-provider
rm -rf node_modules
m -rf plugins
rm package-lock.json
npm cache clean
ionic cordova platform rm ios
ionic cordova platform add ios
ionic cordova prepare ios

Add this code to end of platforms/ios/Podfile

post_install do |installer|
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
      config.build_settings['ONLYARCHIVEARCH'] = 'YES'
      config.build_settings['ONLY_ACTIVE_ARCH'] = 'YES'
      config.build_settings['DEBUG_INFORMATION_FORMAT'] = 'dwarf'
      config.build_settings['CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER'] = 'NO'
      config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 i386"
      config.build_settings["EXCLUDED_ARCHS[sdk=iphoneos*]"] = "x86_64"
      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
      if target.respond_to?(:product_type) and target.product_type == "com.apple.product-type.bundle"
        config.build_settings['CODE_SIGNING_ALLOWED'] = 'NO'
      end
    end
  end
end

Run these commands in console

sudo rm -rf /Users/<myuser>/Library/Developer/Xcode/DerivedData/*
cd platforms/ios
pod deintegrate
pod install
cd ../../
npm install

Open app .xcworkspace generated file in platforms/ios with Xcode 14.2 and set Excluded Architectures to arm64 for all targets (app and Pods)

Go to Xcode Settings => Locations and change Command Line Tools to Xcode 14.2

Build ionic app with this command: ionic cordova build ios --aot --prod --release

Open file platforms/ios/Pods/Target Support Files/<YOUR_APP>/Pods-<YOUR_APP>-frameworks.sh and add -f param to line source="$(readlink "${source}")" so it should end up like this: source="$(readlink -f "${source}")"

When you want to archive app, open project.pbxproj and remove all lines with EXCLUDED_ARCHS

For reference, here is a copy of my package.json

{
  "name": "myapp",
  "version": "0.0.2",
  "author": "Ionic Framework",
  "homepage": "https://ionicframework.com/",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "~8.1.2",
    "@angular/core": "~8.1.2",
    "@angular/forms": "~8.1.2",
    "@angular/platform-browser": "~8.1.2",
    "@angular/platform-browser-dynamic": "~8.1.2",
    "@angular/router": "~8.1.2",
    "@ionic-native/app-rate": "^5.36.0",
    "@ionic-native/app-version": "^5.17.1",
    "@ionic-native/badge": "^5.17.1",
    "@ionic-native/barcode-scanner": "^5.17.1",
    "@ionic-native/clipboard": "^5.31.1",
    "@ionic-native/core": "^5.0.0",
    "@ionic-native/device": "^5.36.0",
    "@ionic-native/diagnostic": "^5.17.1",
    "@ionic-native/firebase-x": "^5.36.0",
    "@ionic-native/geolocation": "^5.36.0",
    "@ionic-native/google-maps": "^5.0.0-beta.27",
    "@ionic-native/in-app-browser": "^5.29.0",
    "@ionic-native/keyboard": "^5.19.1",
    "@ionic-native/launch-navigator": "^5.19.1",
    "@ionic-native/network": "^5.17.1",
    "@ionic-native/screen-orientation": "^5.17.1",
    "@ionic-native/splash-screen": "^5.17.1",
    "@ionic-native/status-bar": "^5.17.1",
    "@ionic-native/unique-device-id": "^5.36.0",
    "@ionic/angular": "^4.7.1",
    "@ionic/storage": "^2.2.0",
    "colors": "1.4.0",
    "cordova-android": "10.1.2",
    "cordova-browser": "6.0.0",
    "cordova-clipboard": "^1.3.0",
    "cordova-plugin-actionsheet": "^2.3.3",
    "cordova-plugin-app-version": "^0.1.14",
    "cordova-plugin-apprate": "^1.5.0",
    "cordova-plugin-badge": "^0.8.8",
    "cordova-plugin-compat": "^1.2.0",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-dialogs": "^2.0.2",
    "cordova-plugin-inappbrowser": "^4.0.0",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-nativestorage": "^2.3.2",
    "cordova-plugin-network-information": "^2.0.2",
    "cordova-plugin-screen-orientation": "^3.0.2",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "~2.4.2",
    "cordova-plugin-whitelist": "~1.3.3",
    "cordova-support-android-plugin": "^1.0.1",
    "cordova-support-google-services": "^1.3.2",
    "cordova-unique-device-id": "^1.3.2",
    "cordova.plugins.diagnostic": "^5.0.1",
    "core-js": "^2.5.4",
    "es6-promise-plugin": "^4.2.2",
    "faker": "5.5.3",
    "ionicons": "git://github.com/ionic-team/ionicons.git#3.0",
    "ios-sim": "^8.0.2",
    "ngx-mask-ionic": "^1.1.2",
    "rxjs": "~6.5.1",
    "rxjs-compat": "^6.5.3",
    "terser": "3.14.1",
    "tslib": "^1.9.0",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^5.0.4",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/architect": "~0.801.2",
    "@angular-devkit/build-angular": "^0.803.29",
    "@angular-devkit/core": "~8.1.2",
    "@angular-devkit/schematics": "~8.1.2",
    "@angular/cli": "~8.1.2",
    "@angular/compiler": "~8.1.2",
    "@angular/compiler-cli": "~8.1.2",
    "@angular/language-service": "~8.1.2",
    "@ionic/angular-toolkit": "^2.1.1",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "^5.0.0",
    "cordova-ios": "^6.3.0",
    "cordova-plugin-androidx-adapter": "^1.1.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-firebasex": "^16.0.0-cli",
    "cordova-plugin-geolocation": "^4.1.0",
    "cordova-plugin-googlemaps": "^2.7.1",
    "cordova-plugin-googlemaps-sdk": "github:mapsplugin/cordova-plugin-googlemaps-sdk",
    "cordova-plugin-ionic-keyboard": "^2.2.0",
    "cordova-plugin-ionic-webview": "^5.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "phonegap-plugin-barcodescanner": "^8.1.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "cordova-plugin-whitelist": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-app-version": {},
      "cordova-plugin-network-information": {},
      "cordova-plugin-screen-orientation": {},
      "cordova.plugins.diagnostic": {
        "ANDROID_SUPPORT_VERSION": "28.+"
      },
      "cordova-plugin-badge": {},
      "cordova-plugin-apprate": {
        "PLAY_CORE_VERSION": "1.+"
      },
      "uk.co.workingedge.phonegap.plugin.launchnavigator": {
        "GOOGLE_API_KEY_FOR_ANDROID": "xxxx",
        "OKHTTP_VERSION": "3.12.0",
        "LOCATION_USAGE_DESCRIPTION": "xxxxx"
      },
      "cordova-plugin-inappbrowser": {},
      "cordova-clipboard": {},
      "cordova-plugin-geolocation": {
        "GPS_REQUIRED": "true"
      },
      "phonegap-plugin-barcodescanner": {
        "ANDROID_SUPPORT_V4_VERSION": "27.+"
      },
      "cordova-plugin-googlemaps": {
        "LOCATION_WHEN_IN_USE_DESCRIPTION": "This app wants to get your location while this app runs only.",
        "LOCATION_ALWAYS_USAGE_DESCRIPTION": "This app wants to get your location always, even this app runs in background."
      },
      "cordova-plugin-ionic-webview": {},
      "cordova-plugin-firebasex": {
        "FIREBASE_ANALYTICS_COLLECTION_ENABLED": "true",
        "FIREBASE_PERFORMANCE_COLLECTION_ENABLED": "true",
        "FIREBASE_CRASHLYTICS_COLLECTION_ENABLED": "true",
        "FIREBASE_FCM_AUTOINIT_ENABLED": "true",
        "ANDROID_ICON_ACCENT": "#FF00FFFF",
        "ANDROID_FIREBASE_PERFORMANCE_MONITORING": "false",
        "ANDROID_PLAY_SERVICES_AUTH_VERSION": "20.4.0",
        "ANDROID_FIREBASE_ANALYTICS_VERSION": "21.2.0",
        "ANDROID_FIREBASE_MESSAGING_VERSION": "23.1.0",
        "ANDROID_FIREBASE_CONFIG_VERSION": "21.2.0",
        "ANDROID_FIREBASE_PERF_VERSION": "20.3.0",
        "ANDROID_FIREBASE_AUTH_VERSION": "21.1.0",
        "ANDROID_FIREBASE_FIRESTORE_VERSION": "24.4.1",
        "ANDROID_FIREBASE_FUNCTIONS_VERSION": "20.2.1",
        "ANDROID_FIREBASE_IID_VERSION": "21.1.0",
        "ANDROID_FIREBASE_INSTALLATIONS_VERSION": "17.1.0",
        "ANDROID_FIREBASE_CRASHLYTICS_VERSION": "18.3.2",
        "ANDROID_FIREBASE_CRASHLYTICS_NDK_VERSION": "18.3.2",
        "ANDROID_GSON_VERSION": "2.9.0",
        "ANDROID_FIREBASE_PERF_GRADLE_PLUGIN_VERSION": "1.4.2",
        "ANDROID_GRPC_OKHTTP": "1.46.0",
        "IOS_USE_PRECOMPILED_FIRESTORE_POD": "false"
      },
      "cordova-plugin-androidx-adapter": {}
    },
    "platforms": [
      "browser",
      "ios",
      "android"
    ]
  }
}

References:

Hope it helps!

anderlaini
  • 1,593
  • 2
  • 24
  • 39
1

Another alternative is to downgrade Xcode to 14.1. Not the most elegant but it got the app compiling again.

amcastror
  • 528
  • 5
  • 15