我正在尝试为ios运行一个新的hello world cordova应用程序。它一直在闪屏上崩溃。
但我一直收到错误
'NSInternalInconsistencyException', reason: 'ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project.
当我导航到hellocordva.xcodeproj并运行
时 run cordova-ios/bin/cordova_plist_to_config_xml .
它不是命令
这里的testapp/platforms/ios/HelloCordova
中的config.xml看起来像
<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap="http://phonegap.com/ns/1.0">
<preference name="AllowInlineMediaPlayback" value="false" />
<preference name="BackupWebStorage" value="cloud" />
<preference name="DisallowOverscroll" value="false" />
<preference name="EnableViewportScale" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="true" />
<preference name="MediaPlaybackRequiresUserAction" value="false" />
<preference name="SuppressesIncrementalRendering" value="false" />
<preference name="SuppressesLongPressGesture" value="false" />
<preference name="Suppresses3DTouchGesture" value="false" />
<preference name="GapBetweenPages" value="0" />
<preference name="PageLength" value="0" />
<preference name="PaginationBreakingMode" value="page" />
<preference name="PaginationMode" value="unpaginated" />
<feature name="LocalStorage">
<param name="ios-package" value="CDVLocalStorage" />
</feature>
<feature name="HandleOpenUrl">
<param name="ios-package" value="CDVHandleOpenURL" />
<param name="onload" value="true" />
</feature>
<feature name="IntentAndNavigationFilter">
<param name="ios-package" value="CDVIntentAndNavigationFilter" />
<param name="onload" value="true" />
</feature>
<feature name="GestureHandler">
<param name="ios-package" value="CDVGestureHandler" />
<param name="onload" value="true" />
</feature>
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
</widget>
这是testapp根目录
中的config.xml文件<?xml version='1.0' encoding='utf-8'?>
<widget id="io.cordova.hellocordova" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:gap = "http://phonegap.com/ns/1.0">
<name>HelloCordova</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
</platform>
</widget>
这里是xcode中的整个错误消息以及帮助
2016-03-23 09:04:35.758 HelloCordova[7284:185520] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/ibraheemabukhdair/Library/Developer/CoreSimulator/Devices/364F5298-04FE-4875-BE94-DEF9F74EA607/data/Containers/Data/Application/AD59ED2C-1BA5-4639-9260-CFF211D7C527/Library/Cookies/io.cordova.hellocordova.binarycookies
2016-03-23 09:04:35.803 HelloCordova[7284:185520] Apache Cordova native platform version 4.0.1 is starting.
2016-03-23 09:04:35.803 HelloCordova[7284:185520] Multi-tasking -> Device: YES, App: YES
2016-03-23 09:04:35.803 HelloCordova[7284:185520] *** Assertion failure in -[MainViewController parseSettingsWithParser:], /Users/ibraheemabukhdair/components/cordova/testapp/platforms/ios/CordovaLib/Classes/Public/CDVViewController.m:149
2016-03-23 09:04:35.805 HelloCordova[7284:185520] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000106eb1d85 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001068fcdeb objc_exception_throw + 48
2 CoreFoundation 0x0000000106eb1bea +[NSException raise:format:arguments:] + 106
3 Foundation 0x0000000106546d5a -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 198
4 HelloCordova 0x00000001063b405e -[CDVViewController parseSettingsWithParser:] + 478
5 HelloCordova 0x00000001063b42fe -[CDVViewController loadSettings] + 110
6 HelloCordova 0x00000001063b38a9 -[CDVViewController __init] + 1017
7 HelloCordova 0x00000001063b3962 -[CDVViewController initWithNibName:bundle:] + 162
8 HelloCordova 0x00000001063b30a9 -[MainViewController initWithNibName:bundle:] + 121
9 HelloCordova 0x00000001063b3abe -[CDVViewController init] + 62
10 HelloCordova 0x00000001063b315e -[MainViewController init] + 62
11 HelloCordova 0x00000001063b2fa3 -[AppDelegate application:didFinishLaunchingWithOptions:] + 115
12 UIKit 0x0000000107a869ac -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 272
13 UIKit 0x0000000107a87c0d -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3415
14 UIKit 0x0000000107a8e568 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1769
15 UIKit 0x0000000107a8b714 -[UIApplication workspaceDidEndTransaction:] + 188
16 FrontBoardServices 0x000000010c4b58c8 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
17 FrontBoardServices 0x000000010c4b5741 -[FBSSerialQueue _performNext] + 178
18 FrontBoardServices 0x000000010c4b5aca -[FBSSerialQueue _performNextFromRunLoopSource] + 45
19 CoreFoundation 0x0000000106dd7301 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
20 CoreFoundation 0x0000000106dcd22c __CFRunLoopDoSources0 + 556
21 CoreFoundation 0x0000000106dcc6e3 __CFRunLoopRun + 867
22 CoreFoundation 0x0000000106dcc0f8 CFRunLoopRunSpecific + 488
23 UIKit 0x0000000107a8af21 -[UIApplication _run] + 402
24 UIKit 0x0000000107a8ff09 UIApplicationMain + 171
25 HelloCordova 0x00000001063b2f11 main + 65
26 libdyld.dylib 0x0000000109d5392d start + 1
27 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
答案 0 :(得分:3)
您可以通过将 config.xml 添加到Targets>Build Phases>Copy Bundle Resources
答案 1 :(得分:1)
我遇到了类似的错误,因为文件实际上已丢失了。在XCode中重命名项目后发生了这种情况。 删除XCode项目并再次构建它解决了它:
rm -rf platforms/ios
phonegap build ios # or cordova build ios