简体   繁体   English

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

[英]terminating with uncaught exception of type NSException

Im currently new in Xcode and IOS, and I opened a finished project in Xcode but when i try to run the project i get these errors:我目前是 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)  

And it sends me to the file main.m which has the following code:它将我发送到包含以下代码的文件 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;
    }
}

It points to the row: int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");它指向行: int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");

I really tried to find any solution here but couldn't find it, hope someone could help me out here, and run the project, maybe we can arrange also a remotely help here我真的试图在这里找到任何解决方案,但找不到,希望有人能在这里帮助我,并运行该项目,也许我们也可以在这里安排远程帮助

Your error message says:您的错误消息说:

reason: 'ERROR: config.xml does not exist.原因:'错误:config.xml 不存在。 Please run cordova-ios/bin/cordova_plist_to_config_xml path/to/project .请运行 cordova-ios/bin/cordova_plist_to_config_xml path/to/project

Even if you have done that already, try it again.即使你已经这样做了,再试一次。 Might help.可能有帮助。

What you have is not a "native" iOS application project, but a hybrid application built with Apache Cordova .您拥有的不是“本机”iOS 应用程序项目,而是使用Apache Cordova构建的混合应用程序。 Based on error note message, it looks like your Cordova setup is not complete.根据错误消息,您的 Cordova 设置似乎未完成。

Have you installed Cordova on your machine?你有没有在你的机器上安装 Cordova? If not, then this question is way too big to be answered here, I'm afraid.如果不是,那么这个问题太大了,恐怕无法在这里回答。 If you have, then just type the suggested command " cordova-ios/bin/cordova_plist_to_config_xml " on terminal in the folder, where your app is located.如果有,则只需在应用程序所在的文件夹中的终端上键入建议的命令“ cordova-ios/bin/cordova_plist_to_config_xml ”。 In that case your "path/to/project" would be .在这种情况下,您的“路径/到/项目”将是. ie just a dot (means current folder)即只是一个点(表示当前文件夹)

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

The file CDVViewController.m is not your own code, but belongs to Cordova.文件CDVViewController.m不是您自己的代码,而是属于 Cordova。 Your own code is most likely HTML, CSS and JS files.您自己的代码很可能是 HTML、CSS 和 JS 文件。

For some reason I get this when I set the Main Interface to MainViewController.xib which should be correct but apparently isn't.出于某种原因,当我将主界面设置为 MainViewController.xib 时,我得到了这个,这应该是正确的,但显然不是。 If I clear the field it starts working again.如果我清除该字段,它将再次开始工作。

Run in the command line: cordova platform remove ios cordova platform add ios在命令行中运行: cordova platform remove ios cordova platform add ios

You can fix this issue by adding config.xml to Targets>Build Phases>Copy Bundle Resources您可以通过将 config.xml 添加到 Targets>Build Phases>Copy Bundle Resources 来解决此问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM