由于未捕获的异常“ NSInvalidArgumentException”而终止应用程序时出错

时间:2019-09-27 09:08:30

标签: ios xcode cordova ionic-framework crash

编译(发布/调试)时出现错误

Terminating app due to uncaught exception NSInvalidArgumentException', reason: '-[__NSDictionaryM cordovaSettingForKey:]: unrecognized selector sent to instance 0x600003ea6ae0'

成功构建myProject之后。我在Xcode中打开我的项目,然后单击Xco​​de上的运行按钮。项目成功构建,并在模拟器设备中显示午餐屏幕。之后,我在main.m中得到一个错误,这就是我在控制台中看到的内容:

#import <UIKit/UIKit.h>

int main(int argc, char* argv[])
{
    @autoreleasepool {
        int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");                              Thread 1: signal SIGABRT

        return retVal;
    }
}

2019-09-27 15:19:14.943154+0530 myApp[3086:93649] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/mk/Library/Developer/CoreSimulator/Devices/EC5630C3-373A-45AD-A404-5628B1B329B9/data/Containers/Data/Application/06D2441B-F5B5-47B8-B6A7-68AEA36BB0D6/Library/Cookies/com.test.my-app.binarycookies
2019-09-27 15:19:14.954425+0530 myApp[3086:93649] Apache Cordova native platform version 5.0.1 is starting.
2019-09-27 15:19:14.954596+0530 myApp[3086:93649] Multi-tasking -> Device: YES, App: YES
2019-09-27 15:19:14.972439+0530 myApp[3086:93649] -[__NSDictionaryM cordovaSettingForKey:]: unrecognized selector sent to instance 0x6000011cc900
2019-09-27 15:19:14.981981+0530 myApp[3086:93649] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM cordovaSettingForKey:]: unrecognized selector sent to instance 0x6000011cc900'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23b98bde __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff503b5b20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23bb9704 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   CoreFoundation                      0x00007fff23b9d7bc ___forwarding___ + 1436
    4   CoreFoundation                      0x00007fff23b9f6c8 _CF_forwarding_prep_0 + 120
    5   myApp                               0x000000010a028723 -[CDVViewController viewDidLoad] + 227
    6   myApp                               0x000000010a004433 -[MainViewController viewDidLoad] + 51
    7   UIKitCore                           0x00007fff46af87c2 -[UIViewController _sendViewDidLoadWithAppearanceProxyObjectTaggingEnabled] + 83
    8   UIKitCore                           0x00007fff46afd6d3 -[UIViewController loadViewIfRequired] + 1084
    9   UIKitCore                           0x00007fff46afdaf0 -[UIViewController view] + 27
    10  UIKitCore                           0x00007fff47199b55 -[UIWindow addRootViewControllerViewIfPossible] + 150
    11  UIKitCore                           0x00007fff4719920b -[UIWindow _updateLayerOrderingAndSetLayerHidden:actionBlock:] + 232
    12  UIKitCore                           0x00007fff4719a2c9 -[UIWindow _setHidden:forced:] + 362
    13  UIKitCore                           0x00007fff471ad46d -[UIWindow _mainQueue_makeKeyAndVisible] + 42
    14  myApp                               0x000000010a01ef3f -[CDVAppDelegate application:didFinishLaunchingWithOptions:] + 703
    15  myApp                               0x000000010a0041ab -[AppDelegate application:didFinishLaunchingWithOptions:] + 187
    16  UIKitCore                           0x00007fff4715994f -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 232
    17  UIKitCore                           0x00007fff4715b2e7 -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 3980
    18  UIKitCore                           0x00007fff47160c05 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1281
    19  UIKitCore                           0x00007fff468b58b1 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
    20  UIKitCore                           0x00007fff46d96cd5 _UIScenePerformActionsWithLifecycleActionMask + 83
    21  UIKitCore                           0x00007fff468b63c3 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
    22  UIKitCore                           0x00007fff468b5e84 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 474
    23  UIKitCore                           0x00007fff468b61f3 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 821
    24  UIKitCore                           0x00007fff468b5a85 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 345
    25  UIKitCore                           0x00007fff468b9e70 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke_2 + 159
    26  UIKitCore                           0x00007fff46cbdf8b +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:actions:completion:] + 865
    27  UIKitCore                           0x00007fff46db51cf _UISceneSettingsDiffActionPerformChangesWithTransitionContext + 240
    28  UIKitCore                           0x00007fff468b9b9e __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke + 153
    29  UIKitCore                           0x00007fff46db50d2 _UISceneSettingsDiffActionPerformActionsWithDelayForTransitionContext + 84
    30  UIKitCore                           0x00007fff468b9a0c -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 381
    31  UIKitCore                           0x00007fff46717c96 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke + 657
    32  UIKitCore                           0x00007fff4671681b -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 248
    33  UIKitCore                           0x00007fff467179c0 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 210
    34  UIKitCore                           0x00007fff4715f262 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 535
    35  UIKitCore                           0x00007fff46cdf774 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 361
    36  FrontBoardServices                  0x00007fff362e1d43 -[FBSSceneImpl _callOutQueue_agent_didCreateWithTransitionContext:completion:] + 442
    37  FrontBoardServices                  0x00007fff3630a00c __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke.154 + 102
    38  FrontBoardServices                  0x00007fff362ecd21 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 220
    39  FrontBoardServices                  0x00007fff36309c9d __86-[FBSWorkspaceScenesClient sceneID:createWithParameters:transitionContext:completion:]_block_invoke + 355
    40  libdispatch.dylib                   0x000000010a387d64 _dispatch_client_callout + 8
    41  libdispatch.dylib                   0x000000010a38acd5 _dispatch_block_invoke_direct + 300
    42  FrontBoardServices                  0x00007fff3633108a __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    43  FrontBoardServices                  0x00007fff36330d78 -[FBSSerialQueue _queue_performNextIfPossible] + 441
    44  FrontBoardServices                  0x00007fff36331287 -[FBSSerialQueue _performNextFromRunLoopSource] + 22
    45  CoreFoundation                      0x00007fff23afbac1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    46  CoreFoundation                      0x00007fff23afb9ec __CFRunLoopDoSource0 + 76
    47  CoreFoundation                      0x00007fff23afb1c4 __CFRunLoopDoSources0 + 180
    48  CoreFoundation                      0x00007fff23af5ecf __CFRunLoopRun + 1263
    49  CoreFoundation                      0x00007fff23af56b6 CFRunLoopRunSpecific + 438
    50  GraphicsServices                    0x00007fff3815cbb0 GSEventRunModal + 65
    51  UIKitCore                           0x00007fff47162a67 UIApplicationMain + 1621
    52  myApp                               0x000000010a0040d1 main + 65
    53  libdyld.dylib                       0x00007fff5123bcf5 start + 1
    54  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

1 个答案:

答案 0 :(得分:0)

您已经实现了-[application:didReceiveRemoteNotification:fetchCompletionHandler:],但是您仍然需要在Info.plist中支持的UIBackgroundModes列表中添加“ remote-notification”。

您是否在应用程序中使用通知功能,如果要让他们问,请检查您的应用程序是否存在永不循环的方法,从而导致该应用程序执行反弹。