科尔多瓦构建iOS错误:在路径'path / to / myApp.xcarchive“

时间:2018-09-11 18:10:11

标签: ios cordova phonegap cordova-3

我一直在努力让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和Xcode10。

5 个答案:

答案 0 :(得分:127)

围绕here有一个解决方法。

如果在命令行上构建,则可以指定--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中打开项目,则需要将“工作空间设置”中的构建系统更改为“旧版构建系统”

答案 1 :(得分:36)

解决方案---buildFlag="-UseModernBuildSystem=0"或设置旧版构建系统都不适用于我。

由于某种原因,只有在我确定在运行cordova build命令之前从计算机上的USB拔下iPad或iPhone时,错误才会消失。

关于我的配置,也许有些古怪,但是我想分享一下,以防它对其他人有帮助。

答案 2 :(得分:3)

如果不想一直在构建标记中进行设置,请打开 MyApp.xcworkspace 并转到:

边注:是的,您需要始终通过在cordova中添加ios平台来执行此操作。 (例如,您删除并再次添加了ios平台)

  

文件>工作区设置>选择构建系统:旧版构建   系统

enter image description here

答案 3 :(得分:2)

Cordova iOS自5.0.0起支持新的构建系统(请参见release notes)。

因此,将您的package.json更新为"cordova-ios": "5.0.0"(或更高版本)并调用npm install

请注意,之后我必须清理所有内容(删除目录平台,插件,www),以使其正常工作。

答案 4 :(得分:0)

当您在连接到Mac的设备上运行cordova ios build --prod时也会发生这种情况。拔下电源,然后重试。