ios - 以 NSException 类型的未捕获异常终止

标签 ios objective-c xcode cordova

我目前是 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");

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

最佳答案

您的错误信息是:

reason: 'ERROR: config.xml does not exist. Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project.

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

您拥有的不是“ native ”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 文件。

关于ios - 以 NSException 类型的未捕获异常终止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34362655/

相关文章:

iphone - iPhone 和 iPad 中的缓存目录有多大?

ios - 带有 NSURLSession 的 HTTP PUT 方法

xcode - 将 Assets 目录复制到另一个项目

iPhone:推送通知后如何删除徽章?

swift - viewWillEnterForeground问题

android - Havok 物理引擎 - Android

ios - Swift CoreData 模型有帮助吗? (给出的例子)

android - Xamarin.Forms 后台/前台服务最佳实践?

objective-c - NSOperation 中的 NSURLConnection

ios - 如果我想让一个任务在后台运行, "dispatch_get_global_queue"队列如何工作?