我正在尝试构建我的 Ionic / Cordova 应用程序,但收到此错误:
The following build commands failed:
ScanDependencies /Users/myuser/Library/Developer/Xcode/DerivedData/myapp-gcpsxwgciwwqcxghqjubozbsahac/Build/Intermediates.noindex/myapp.build/Release-iphonesimulator/myapp.build/Objects-normal/x86_64/FirebasePlugin.o /Users/myuser/dev/myapp-ionic/platforms/ios/myapp/Plugins/cordova-plugin-firebasex/FirebasePlugin.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'myapp' from project 'myapp')
Building workspace MyApp with scheme MyApp and configuration Release
(2 failures)
xcodebuild: Command failed with exit code 65
[ERROR] An error occurred while running subprocess cordova.
我没有发现任何带有 ScanDependency 错误的引用,所以我对此很迷茫。
到目前为止我尝试过的:
DerivedData
文件夹plugins
文件夹node_modules
文件夹www
文件夹gems
ios
平台总是遇到同样的问题。
关于如何更好地调查此错误有什么想法吗?
我使用 Mac M1 与 MacOS Sequoia 和 Xcode 16。
我终于在 Xcode 16 上运行了。这里有一些指导。
清理并重新安装iOS平台
rm package-lock.json
rm -rf node_modules
rm -rf plugins
rm -rf www
npm i
ionic cordova platform rm ios
ionic cordova platform add ios@^6.3.0
ionic cordova prepare ios
sudo rm -rf /Users/myuser/Library/Developer/Xcode/DerivedData/*
更新
post_install
代码块位于platforms/ios/Podfile
post_install do |installer|
installer.pods_project.targets.each do |target|
if target.name == 'BoringSSL-GRPC'
target.source_build_phase.files.each do |file|
if file.settings && file.settings['COMPILER_FLAGS']
flags = file.settings['COMPILER_FLAGS'].split
flags.reject! { |flag| flag == '-GCC_WARN_INHIBIT_ALL_WARNINGS' }
file.settings['COMPILER_FLAGS'] = flags.join(' ')
end
end
end
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64"
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['IPHONEOS_DEPLOYMENT_TARGET'] = '12.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
重新安装 Pod
cd platforms/ios && pod deintegrate && pod install && cd ../../
准备 Ionic 项目
ionic cordova prepare ios
使用 Xcode 16
打开
.xcworkspace
arm64
添加到 Exclude Architectures
Build Active Architecture Only (Debug)
返回终端并构建 ionic
ionic cordova build ios --prod --release --aot