我正在try 像以前一样编译我的应用程序,但它返回以下错误:

** 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.

到目前为止,我try 的是:

  • 删除并添加Cordova iOS Platform@5.1.1
  • ionic repair几次
  • POD解体&POD安装

我的Package.json有

"@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"
  ]
}

我的ionic 信息

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

我的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

推荐答案

经过大量研究,我可以构建我的应用程序.

有很多问题,所以我不确定哪一个是确切的解决方案,但这是我目前的构建过程.

使用NODE v18+Xcode 14.2(从网上下载以前的版本)

在控制台中运行

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

将此代码添加到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

在控制台中运行这些命令

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

使用Xcode 14.2在platforms/ios中打开APP .xcworkspace生成的文件,并将所有目标(APP和Pod)的Excluded Architectures设置为arm64

转到Xcode设置=>;位置并将Command Line Tools更改为Xcode 14.2

使用以下命令构建Ionic应用程序:ionic cordova build ios --aot --prod --release

打开文件platforms/ios/Pods/Target Support Files/<YOUR_APP>/Pods-<YOUR_APP>-frameworks.sh,在第source="$(readlink "${source}")"行添加-f个参数,结果应该是这样的:source="$(readlink -f "${source}")"

当您想存档应用程序时,打开project.pbxproj并移除所有带有EXCLUDED_ARCHS的行

作为参考,这里有一份我的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"
    ]
  }
}

参考资料:

希望它能帮上忙!

Ios相关问答推荐

SWIFT设备方向更新不正确

如何从Windows PC在iPhone上安装Flutter 应用程序

OnTapGesture在其修改的视图外部触发

SwiftData共享扩展阻止应用程序打开SQLite文件

无法关闭包含字体 Select 器的工作表

多协议和类继承混乱,Swift

SwiftUI - 如何从主题感知命名 colored颜色 中获取正确的 RGB 值?

在 iPad 上删除列表的顶部和底部行

无法结合 UIImageView 旋转动画和 tableView 部分重新加载

将 SwiftUI 与 @AppStorage 和动态函数调用一起使用

SignalR 永远不会在 iOS 上使用 Xamarin Forms 启动

访问未定义的 stage_in 金属着色器参数

警告:iPad:Icon-72.png:图标尺寸(0 x 0)

故事板中的 colored颜色 与 UIColor 不匹配

水平滚动 UICollectionView 时对齐单元格的中心

如何识别导航堆栈中的前一个视图控制器

iOS在应用程序中下载并保存图像

Swift 中的日期到毫秒和回溯到日期

如何在ios中生成UUID

以编程方式确定 iPhone 是否越狱