离子3问题:***因未捕获的异常终止应用程序

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了离子3问题:***因未捕获的异常终止应用程序相关的知识,希望对你有一定的参考价值。

我正在研究一个离子项目,我们在这个问题上遇到了很长时间:

[1230:250895] *由于未捕获的异常'NSInvalidArgumentException'而终止应用程序,原因:'* - [__ NSArrayM insertObject:atIndex:]:object不能为nil'

libc ++ abi.dylib:以NSException类型的未捕获异常终止

我们不知道错误来自何处,通过使用断点,这是错误部分:

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

我相信它是一个包问题,但这里是我的package.json

{
  "name": "discover_v2",
  "version": "0.0.1",
  "author": "Ionic Framework",
  "homepage": "http://ionicframework.com/",
  "private": true,
  "scripts": {
    "start": "ionic-app-scripts serve",
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "lint": "ionic-app-scripts lint"
  },
  "dependencies": {
    "@angular/animations": "5.2.11",
    "@angular/common": "5.2.11",
    "@angular/compiler": "5.2.11",
    "@angular/compiler-cli": "5.2.11",
    "@angular/core": "5.2.11",
    "@angular/forms": "5.2.11",
    "@angular/http": "5.2.11",
    "@angular/platform-browser": "5.2.11",
    "@angular/platform-browser-dynamic": "5.2.11",
    "@ionic-native/barcode-scanner": "^4.16.0",
    "@ionic-native/camera": "^4.17.0",
    "@ionic-native/core": "~4.15.0",
    "@ionic-native/device": "^5.2.0",
    "@ionic-native/facebook": "^4.17.0",
    "@ionic-native/fcm": "^4.18.0",
    "@ionic-native/file-transfer": "^4.17.0",
    "@ionic-native/firebase": "^4.18.0",
    "@ionic-native/http": "^4.17.0",
    "@ionic-native/in-app-browser": "^4.17.0",
    "@ionic-native/local-notifications": "^4.18.0",
    "@ionic-native/splash-screen": "~4.15.0",
    "@ionic-native/status-bar": "~4.15.0",
    "@ionic/pro": "2.0.3",
    "@ionic/storage": "2.2.0",
    "cordova-android": "7.1.4",
    "cordova-browser": "5.0.4",
    "cordova-ios": "5.0.0",
    "cordova-plugin-advanced-http": "^2.0.1",
    "cordova-plugin-android-support-v13": "git+https://github.com/nnexai/cordova-plugin-android-support-v13.git",
    "cordova-plugin-camera": "4.0.3",
    "cordova-plugin-device": "^2.0.2",
    "cordova-plugin-facebook4": "1.7.4",
    "cordova-plugin-file": "^6.0.1",
    "cordova-plugin-file-transfer": "1.7.1",
    "cordova-plugin-firebase": "2.0.5",
    "cordova-plugin-inappbrowser": "3.0.0",
    "cordova-plugin-ionic-keyboard": "^2.1.3",
    "cordova-plugin-ionic-webview": "^2.2.0",
    "cordova-plugin-local-notifications": "1.0.0",
    "cordova-plugin-splashscreen": "^5.0.2",
    "cordova-plugin-statusbar": "^2.4.2",
    "cordova-plugin-whitelist": "^1.3.3",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "ngx-qrcode2": "0.0.9",
    "phonegap-plugin-barcodescanner": "^8.0.0",
    "rxjs": "5.5.11",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.26"
  },
  "devDependencies": {
    "@ionic/app-scripts": "3.2.0",
    "@ionic/lab": "1.0.22",
    "typescript": "~2.6.2"
  },
  "description": "An Ionic project",
  "cordova": {
    "plugins": {
      "phonegap-plugin-barcodescanner": {
        "CAMERA_USAGE_DESCRIPTION": "Scan QR-Codes",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "App would like to access the library.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "App would like to access the library."
      },
      "cordova-plugin-whitelist": {},
      "cordova-plugin-device": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-ionic-webview": {
        "ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
       },
      "cordova-plugin-ionic-keyboard": {},
      "cordova-plugin-advanced-http": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-firebase": {},
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": "Scan QR-Codes",
        "PHOTOLIBRARY_USAGE_DESCRIPTION": "App would like to access the library.",
        "PHOTO_LIBRARY_USAGE_DESCRIPTION": "App would like to access the library."
      },
      "cordova-plugin-facebook4": {
        "APP_ID": "338050196981589",
        "APP_NAME": "usediscover"
      },
      "cordova-plugin-statusbar": {},
      "cordova-plugin-inappbrowser": {}
     },
     "platforms": [
       "browser",
       "android",
       "ios"
     ]
  }
}
答案

NSArrayM insertObject:atIndex:]: object cannot be nil'可能重复

以上是关于离子3问题:***因未捕获的异常终止应用程序的主要内容,如果未能解决你的问题,请参考以下文章

NSGenericException',原因:'无法在视图上安装约束

Android 平台的Crash崩溃捕获-全

来自第 3 方静态库的回调中未捕获的异常

由于未捕获的异常而终止应用程序,原因:“尝试从第 1 部分删除第 3 行,更新前仅包含 0 行”

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

由于未捕获的异常“UIViewControllerHierarchyInconsistency”而终止应用程序