作者:actthank90909 | 来源:互联网 | 2022-12-05 10:27
我一直在努力让Cordova工作并在我的iPhone上运行.我按照下面的命令,但在构建时看到以下错误:
cordova create myApp org.apache.cordova.myApp myApp
cd myApp
cordova platform add ios
cordova build ios
我收到以下错误:
Building project: /Users/ben/Desktop/myTest/platforms/ios/myTest.xcworkspace
Configuration: Debug
Platform: device
User defaults from command line:
IDEArchivePathOverride = /Users/ben/Desktop/myTest/platforms/ios/myTest.xcarchive
Build settings from command line:
CONFIGURATION_BUILD_DIR = /Users/ben/Desktop/myTest/platforms/ios/build/device
SHARED_PRECOMPS_DIR = /Users/ben/Desktop/myTest/platforms/ios/build/sharedpch
Build settings from configuration file '/Users/ben/Desktop/myTest/platforms/ios/cordova/build-debug.xcconfig':
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES
CODE_SIGN_ENTITLEMENTS = $(PROJECT_DIR)/$(PROJECT_NAME)/Entitlements-$(CONFIGURATION).plist
CODE_SIGN_IDENTITY = iPhone Developer
ENABLE_BITCODE = NO
GCC_PREPROCESSOR_DEFINITIOnS= DEBUG=1
HEADER_SEARCH_PATHS = "$(TARGET_BUILD_DIR)/usr/local/lib/include" "$(OBJROOT)/UninstalledProducts/include" "$(OBJROOT)/UninstalledProducts/$(PLATFORM_NAME)/include" "$(BUILT_PRODUCTS_DIR)"
OTHER_LDFLAGS = -ObjC
SWIFT_OBJC_BRIDGING_HEADER = $(PROJECT_DIR)/$(PROJECT_NAME)/Bridging-Header.h
error: archive not found at path '/Users/ben/Desktop/myTest/platforms/ios/myTest.xcarchive'
** EXPORT FAILED **
(node:4984) UnhandledPromiseRejectionWarning: Error code 65 for command: xcodebuild with args: -exportArchive,-archivePath,myTest.xcarchive,-exportOptionsPlist,/Users/ben/Desktop/myTest/platforms/ios/exportOptions.plist,-exportPath,/Users/ben/Desktop/myTest/platforms/ios/build/device
(node:4984) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:4984) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
我试过删除和添加平台.此外,还卸载的东西.
我在macOS High Sierra和Xcode 10上.
1> Samuel Hsieh..:
有一个变通这里.
如果您在命令行上构建,则可以指定--buildFlag =" - UseModernBuildSystem = 0":
# Cordova CLI
cordova run ios --buildFlag='-UseModernBuildSystem=0'
cordova build ios --buildFlag='-UseModernBuildSystem=0'
# Ionic CLI
ionic cordova run ios -- --buildFlag="-UseModernBuildSystem=0"
ionic cordova build ios -- --buildFlag="-UseModernBuildSystem=0"
如果您使用build.json配置文件构建,则可以在iOS版本或调试配置下添加以下内容:
"buildFlag": [
"-UseModernBuildSystem=0"
]
如果要在Xcode IDE中打开项目,则需要将Workspace Settings中的构建系统更改为"Legacy Build System"
_reason_是Xcode 10有一个新的构建系统,`cordova-ios`还不支持.见[公告](https://github.com/apache/cordova-ios/issues/407).
在XCode 10中 - 要更改为旧版构建系统,请使用文件 - >项目设置 - 构建系统 - >旧版构建系统." - buildflag"解决方案最初对我起作用然后没有.科尔多瓦清洁也一直在抛出错误/失败.一旦我切换到Legacy Build,一切都很好.
2> jessica..:
这两种解决方案 - --buildFlag="-UseModernBuildSystem=0"
或者设置Legacy Build System 都不适用于我.
出于某种原因,如果我确定在运行cordova build命令之前从我的计算机上的USB上拔下我的iPad或iPhone,那么错误就会消失.
也许对我的配置很古怪,但我想我会分享它以帮助其他人.
和我一样.拔掉插头,错误消失了.