ios - [__NSDictionaryM cordovaSettingForKey :]: unrecognized selector sent to instance

标签 ios cordova

我是 XCODE 的新手,收到了这条错误消息。你能帮我解决一下吗?

Screenshot

2018-12-08 21:46:22.258801-0500 IAOGI English App[653:6168] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///Users/admin/Library/Developer/CoreSimulator/Devices/753BE612-F65B-44E8-A727-347043E8736A/data/Containers/Data/Application/8D1AD8A3-6384-48C0-8C1C-29F27E098D80/Library/Cookies/com.iaogcan.english.binarycookies

2018-12-08 21:46:23.175378-0500 IAOGI English App[653:6168] Apache Cordova native platform version 4.5.5 is starting.

2018-12-08 21:46:23.177968-0500 IAOGI English App[653:6168] Multi-tasking -> Device: YES, App: YES

2018-12-08 21:46:23.210797-0500 IAOGI English App[653:6168] -[__NSDictionaryM cordovaSettingForKey:]: unrecognized selector sent to instance 0x60000040df20

2018-12-08 21:46:23.277812-0500 IAOGI English App[653:6168] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM cordovaSettingForKey:]: unrecognized selector sent to instance 0x60000040df20'

*** First throw call stack: ( 0 CoreFoundation 0x000000010d54b1bb __exceptionPreprocess + 331

1 libobjc.A.dylib 0x000000010cabb735 objc_exception_throw + 48

2 CoreFoundation 0x000000010d569f44 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132

3 CoreFoundation 0x000000010d54fed6 forwarding + 1446

4 CoreFoundation 0x000000010d551da8 _CF_forwarding_prep_0 + 120

5 IAOGI English App 0x000000010a9cacc7 -[CDVViewController viewDidLoad] + 199

6 IAOGI English App 0x000000010a955df6 -[MainViewController viewDidLoad] + 54

7 UIKitCore 0x000000011acc14e1 -[UIViewController loadViewIfRequired] + 1186

8 UIKitCore 0x000000011acc1940 -[UIViewController view] + 27

9 UIKitCore 0x000000011b318c53 -[UIWindow addRootViewControllerViewIfPossible] + 122

10 UIKitCore 0x000000011b31936e -[UIWindow _setHidden:forced:] + 294

11 UIKitCore 0x000000011b32c5c0 -[UIWindow makeKeyAndVisible] + 42

12 IAOGI English App 0x000000010a9cf4d0 -[CDVAppDelegate application:didFinishLaunchingWithOptions:] + 752

13 IAOGI English App 0x000000010a955b73 -[AppDelegate application:didFinishLaunchingWithOptions:] + 195

14 UIKitCore 0x000000011b2d7bde -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 280

15 UIKitCore 0x000000011b2d95cb -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 3979

16 UIKitCore 0x000000011b2dec2f -[UIApplication _runWithMainScene:transitionContext:completion:] + 1623

17 UIKitCore 0x000000011aafd4e9 __111-[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:]_block_invoke + 866

18 UIKitCore 0x000000011ab0629c +[_UICanvas _enqueuePostSettingUpdateTransactionBlock:] + 153

19 UIKitCore 0x000000011aafd126 -[__UICanvasLifecycleMonitor_Compatability _scheduleFirstCommitForScene:transition:firstActivation:completion:] + 233

20 UIKitCore 0x000000011aafdae0 -[__UICanvasLifecycleMonitor_Compatability activateEventsOnly:withContext:completion:] + 1085

21 UIKitCore 0x000000011aafbcb5 __82-[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:]_block_invoke + 795

22 UIKitCore 0x000000011aafb95f -[_UIApplicationCanvas _transitionLifecycleStateWithTransitionContext:completion:] + 435

23 UIKitCore 0x000000011ab00a90 __125-[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:]_block_invoke + 584

24 UIKitCore 0x000000011ab0180e _performActionsWithDelayForTransitionContext + 100

25 UIKitCore 0x000000011ab007ef -[_UICanvasLifecycleSettingsDiffAction performActionsForCanvas:withUpdatedScene:settingsDiff:fromSettings:transitionContext:] + 221

26 UIKitCore 0x000000011ab0593a -[_UICanvas scene:didUpdateWithDiff:transitionContext:completion:] + 392

27 UIKitCore 0x000000011b2dd44e -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 515

28 UIKitCore 0x000000011ae81d09 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 357

29 FrontBoardServices 0x0000000116c1d2da -[FBSSceneImpl _didCreateWithTransitionContext:completion:] + 448

30 FrontBoardServices 0x0000000116c28443 __56-[FBSWorkspace client:handleCreateScene:withCompletion:]_block_invoke_2 + 271

31 FrontBoardServices 0x0000000116c27b3a __40-[FBSWorkspace _performDelegateCallOut:]_block_invoke + 53

32 libdispatch.dylib 0x000000010f8cc602 _dispatch_client_callout + 8

33 libdispatch.dylib 0x000000010f8cfb78 _dispatch_block_invoke_direct + 301

34 FrontBoardServices 0x0000000116c5cba8 FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK + 30

35 FrontBoardServices 0x0000000116c5c860 -[FBSSerialQueue _performNext] + 457

36 FrontBoardServices 0x0000000116c5ce40 -[FBSSerialQueue _performNextFromRunLoopSource] + 45

37 CoreFoundation 0x000000010d4b0721 CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION + 17

38 CoreFoundation 0x000000010d4aff93 __CFRunLoopDoSources0 + 243

39 CoreFoundation 0x000000010d4aa63f __CFRunLoopRun + 1263

40 CoreFoundation 0x000000010d4a9e11 CFRunLoopRunSpecific + 625

41 GraphicsServices 0x00000001128761dd GSEventRunModal + 62

42 UIKitCore 0x000000011b2e081d UIApplicationMain + 140

43 IAOGI English App 0x000000010a955a91 main + 65

44 libdyld.dylib 0x000000010f942575 start + 1

45 ??? 0x0000000000000001 0x0 + 1 ) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

最佳答案

此错误表明 CordovaPreferences category没有被加载。这表明这是静态链接,但 -objc 标志未传递给链接器。参见 QA1490: Building Objective-C static libraries with categories .我不熟悉 Cordova 的构建系统,但这表明您可能绕过了它,或者项目设置已损坏。 (我这辈子从未接触过 Cordova,除了它的说明表明有一些特殊的构建步骤外,我对它的构建方式一无所知。)

这个堆栈的重要部分是这个框架:

5 IAOGI English App 0x000000010a9cacc7 -[CDVViewController viewDidLoad] + 199

这是通用断言逻辑之前的最后一帧。在 GitHub 中搜索“CDVViewController”会将我们带到 CDVViewController.m .它的-viewDidLoad包括:

id backupWebStorage = [self.settings cordovaSettingForKey:@"BackupWebStorage"];

查找 settings 显示它是一个 NSMutableDictionary:

@property (nonatomic, readwrite, strong) NSMutableDictionary* settings;

由于 cordovaSettingForKey: 不是 NSMutableDictionary 上的标准方法,它很可能是类别方法,我们可以在源代码中多搜索一下找到它.该文件遵循标准命名模式:NSDictionary+CordovaPreferences.h(由 + 分隔的类和类别名称)。

关于ios - [__NSDictionaryM cordovaSettingForKey :]: unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53689021/

相关文章:

android - 使用相机插件拍摄新照片时 PhoneGap 应用程序崩溃

javascript - Phonegap+JQuery 移动 : How to fire a popup from the Android menu button?

ios - 使用 https 网址预填充短信正文

objective-c - iOS 核心动画加速

iOS SDK : how can I find if a link is download-able?

php - Phonegap Android上传到远程数据库失败

javascript - 获取上一页 phonegap javascript

eclipse - Phonegap eclipse插件安装问题

ios - navigationController属性在UINavigationController.h中声明,但它是UIViewController的属性

ios - 在 ScrollView 中淡出边缘