6

我正在尝试为 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 .它不是命令

这里是 config.xml 在里面testapp/platforms/ios/HelloCordova的样子

<?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
4

2 回答 2

8

您可以通过将config.xml添加到Targets>Build Phases>Copy Bundle Resources

于 2017-09-25T15:00:42.927 回答
1

我有一个类似的错误,这是因为文件实际上丢失了。它发生在在 XCode 中重命名项目之后。删除 XCode 项目并再次构建它解决了它:

rm -rf platforms/ios
phonegap build ios  # or cordova build ios
于 2016-10-31T12:20:37.660 回答