【问题标题】:terminating with uncaught exception of type NSException以 NSException 类型的未捕获异常终止
【发布时间】:2016-03-25 13:52:28
【问题描述】:

我目前是 Xcode 和 IOS 的新手,我在 Xcode 中打开了一个已完成的项目,但是当我尝试运行该项目时出现以下错误:

    2015-12-18 20:05:49.729 Arsene[7069:78785] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/Refresh/Library/Developer/CoreSimulator/Devices/D1119725-6C13-49FE-A46E-808147418747/data/Containers/Data/Application/AF3B04B0-7A18-44C9-9ADB-3FD2A953F01C/Library/Cookies/Codeators.binarycookies
2015-12-18 20:05:49.808 Arsene[7069:78785] Apache Cordova native platform version 3.8.0 is starting.
2015-12-18 20:05:49.809 Arsene[7069:78785] Multi-tasking -> Device: YES, App: YES
2015-12-18 20:05:49.809 Arsene[7069:78785] *** Assertion failure in -[MainViewController loadSettings], /Users/Refresh/Downloads/arsne_v113/app/platforms/ios/CordovaLib/Classes/CDVViewController.m:172
2015-12-18 20:05:49.814 Arsene[7069:78785] *** 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                      0x00573a14 __exceptionPreprocess + 180
    1   libobjc.A.dylib                     0x03875e02 objc_exception_throw + 50
    2   CoreFoundation                      0x005738aa +[NSException raise:format:arguments:] + 138
    3   Foundation                          0x034f3d26 -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 118
    4   Arsene                              0x000c7867 -[CDVViewController loadSettings] + 519
    5   Arsene                              0x000c6de6 -[CDVViewController __init] + 1286
    6   Arsene                              0x000c6eae -[CDVViewController initWithNibName:bundle:] + 190
    7   Arsene                              0x000b7842 -[MainViewController initWithNibName:bundle:] + 146
    8   UIKit                               0x00aca332 -[UIViewController init] + 49
    9   Arsene                              0x000c7057 -[CDVViewController init] + 71
    10  Arsene                              0x000b7914 -[MainViewController init] + 68
    11  Arsene                              0x000b6e49 -[AppDelegate application:didFinishLaunchingWithOptions:] + 505
    12  UIKit                               0x008f9172 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 337
    13  UIKit                               0x008fa5a0 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3863
    14  UIKit                               0x00901cd6 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1989
    15  UIKit                               0x00926ee5 __84-[UIApplication _handleApplicationActivationWithScene:transitionContext:completion:]_block_invoke3218 + 68
    16  UIKit                               0x008fe966 -[UIApplication workspaceDidEndTransaction:] + 163
    17  FrontBoardServices                  0x04556c76 __37-[FBSWorkspace clientEndTransaction:]_block_invoke_2 + 71
    18  FrontBoardServices                  0x0455674d __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 54
    19  FrontBoardServices                  0x04574173 -[FBSSerialQueue _performNext] + 184
    20  FrontBoardServices                  0x045745aa -[FBSSerialQueue _performNextFromRunLoopSource] + 52
    21  FrontBoardServices                  0x045738a6 FBSSerialQueueRunLoopSourceHandler + 33
    22  CoreFoundation                      0x0048d6ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15
    23  CoreFoundation                      0x0048338b __CFRunLoopDoSources0 + 523
    24  CoreFoundation                      0x004827a8 __CFRunLoopRun + 1032
    25  CoreFoundation                      0x004820e6 CFRunLoopRunSpecific + 470
    26  CoreFoundation                      0x00481efb CFRunLoopRunInMode + 123
    27  UIKit                               0x008fe206 -[UIApplication _run] + 540
    28  UIKit                               0x00903bfa UIApplicationMain + 160
    29  Arsene                              0x000b6a99 main + 89
    30  libdyld.dylib                       0x0406fa21 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)  

它会将我发送到包含以下代码的文件 main.m:

/*
 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements.  See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership.  The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License.  You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing,
 software distributed under the License is distributed on an
 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 KIND, either express or implied.  See the License for the
 specific language governing permissions and limitations
 under the License.
 */
//
//  main.m
//  Arsene
//
//  Created by ___FULLUSERNAME___ on ___DATE___.
//  Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved.
//

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
        return retVal;
    }
}

它指向行:int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

我真的想在这里找到任何解决方案但找不到,希望有人可以在这里帮助我,并运行项目,也许我们也可以在这里安排远程帮助

【问题讨论】:

标签: ios objective-c xcode cordova


【解决方案1】:

你的错误信息说:

原因:'错误:config.xml 不存在。 请运行 cordova-ios/bin/cordova_plist_to_config_xml path/to/project

即使您已经这样做了,请再试一次。可能会有所帮助。

您拥有的不是“原生”iOS 应用程序项目,而是使用Apache Cordova 构建的混合应用程序。根据错误提示消息,您的 Cordova 设置似乎不完整。

您的机器上安装了 Cordova 吗?如果不是,那么这个问题太大了,恐怕无法在这里回答。如果你有,那么只需在你的应用所在文件夹的终端上键入建议的命令“cordova-ios/bin/cordova_plist_to_config_xml”。在这种情况下,您的“路径/到/项目”将是 .,即只是一个点(表示当前文件夹)

cordova-ios/bin/cordova_plist_to_config_xml path/to/project

文件CDVViewController.m 不是您自己的代码,而是属于Cordova。您自己的代码很可能是 HTML、CSS 和 JS 文件。

【讨论】:

  • “运行”是什么意思,如何运行请多解释,因为我是新来的:P
  • 更新了答案。运行意味着打开终端并在那里输入命令。
【解决方案2】:

由于某种原因,当我将主界面设置为 MainViewController.xib 时,我得到了这个,这应该是正确的,但显然不是。如果我清除该字段,它将重新开始工作。

【讨论】:

    【解决方案3】:

    在命令行中运行: cordova platform remove ios cordova platform add ios

    【讨论】:

      【解决方案4】:

      您可以通过将 config.xml 添加到 Targets>Build Phases>Copy Bundle Resources 来解决此问题

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2017-07-25
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2013-07-20
        • 2014-07-26
        • 2015-09-08
        相关资源
        最近更新 更多