在你说“这是一个问题的重复”之前,我已经检查过这个问题了,它告诉我的就是检查我的销售点。我所有的出口都是正确的,我不知道为什么我会犯这个错误。下面是详细的错误:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSTaggedPointerString objectForKeyedSubscript:]: unrecognized selector sent to instance 0xa00000000006e652'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ddf5d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010d85e21e objc_exception_throw + 48
2 CoreFoundation 0x000000010de65f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010dd7b005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010dd7ab88 _CF_forwarding_prep_0 + 120
5 Calc 0x0000000108d00b37 -[MPCoreInstanceProvider appTransportSecuritySettings] + 284
6 Calc 0x0000000108cc4147 +[MPAdServerURLBuilder queryParameterForAppTransportSecurity] + 76
7 Calc 0x0000000108cc30d4 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:versionParameterName:version:testing:desiredAssets:adSequence:] + 1674
8 Calc 0x0000000108cc2a01 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:versionParameterName:version:testing:desiredAssets:] + 173
9 Calc 0x0000000108cc2920 +[MPAdServerURLBuilder URLWithAdUnitID:keywords:location:testing:] + 116
10 Calc 0x0000000108cd3cde -[MPBannerAdManager loadAdWithURL:] + 470
11 Calc 0x0000000108cc03a2 -[MPAdView loadAd] + 48
12 Calc 0x000000010895aa1f _TFFC4Calc18MenuViewController11viewDidLoadFT_T_L_7loadAdsfT_T_ + 175
13 Calc 0x0000000108957d18 _TFC4Calc18MenuViewController11viewDidLoadfT_T_ + 8104
14 Calc 0x000000010895b632 _TToFC4Calc18MenuViewController11viewDidLoadfT_T_ + 34
15 UIKit 0x00000001099cb8b1 -[UIViewController loadViewIfRequired] + 1258
16 UIKit 0x00000001099cbce4 -[UIViewController view] + 27
17 UIKit 0x0000000109895405 -[UIWindow addRootViewControllerViewIfPossible] + 71
18 UIKit 0x0000000109895b56 -[UIWindow _setHidden:forced:] + 293
19 UIKit 0x00000001098a9469 -[UIWindow makeKeyAndVisible] + 42
20 Calc 0x0000000108c32264 _TFC4Calc11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 5716
21 Calc 0x0000000108c34674 _TToFC4Calc11AppDelegate11applicationfTCSo13UIApplication29didFinishLaunchingWithOptionsGSqGVs10DictionaryVSC29UIApplicationLaunchOptionsKeyP____Sb + 180
22 UIKit 0x0000000109820312 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 290
23 UIKit 0x0000000109821c97 -[UIApplication _callInitializationDelegatesForMainScene:transitionContext:] + 4236
24 UIKit 0x000000010982803d -[UIApplication _runWithMainScene:transitionContext:completion:] + 1731
25 UIKit 0x00000001098251bd -[UIApplication workspaceDidEndTransaction:] + 188
26 FrontBoardServices 0x00000001160176cb __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 24
27 FrontBoardServices 0x0000000116017544 -[FBSSerialQueue _performNext] + 189
28 FrontBoardServices 0x00000001160178cd -[FBSSerialQueue _performNextFromRunLoopSource] + 45
29 CoreFoundation 0x000000010dd9a761 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
30 CoreFoundation 0x000000010dd7f98c __CFRunLoopDoSources0 + 556
31 CoreFoundation 0x000000010dd7ee76 __CFRunLoopRun + 918
32 CoreFoundation 0x000000010dd7e884 CFRunLoopRunSpecific + 420
33 UIKit 0x0000000109823a3a -[UIApplication _run] + 434
34 UIKit 0x0000000109829bb8 UIApplicationMain + 159
35 Calc 0x0000000108c4617f main + 111
36 libdyld.dylib 0x0000000110df668d start + 1
37 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
最佳答案
似乎您的应用程序的Info.plist
对于NSAppTransportSecurity
或其子级可能没有正确的值。
退房:MPCoreInstanceProvider.m。
“这是一个问题的重复”-下次查看堆栈跟踪时,它包含所需的所有提示:
靠近顶部的-[NSObject(NSObject) doesNotRecognizeSelector:]
将引发异常(objc_exception_throw
…)doesNotRecognizeSelector
意味着一些代码试图调用一个不可用的方法
哪一个?再看上面:-[NSTaggedPointerString objectForKeyedSubscript:]
所以缺少的方法是objectForKeyedSubscript:
这是Objective-C编译器为如下表达式生成的:myObject[@"title"]
它还告诉您调用方法的对象的类:NSTaggedPointerString
,因此有些代码试图在纯字符串上使用[]
,这没有多大意义
接下来要检查的是谁调用了该代码:-[MPCoreInstanceProvider appTransportSecuritySettings]
是堆栈中最后一个常规代码
所以你就躲起来,找到MPCoreInstanceProvider.m
正好有一个MPCoreInstanceProvider
方法
查看代码时,它会抓取一本字典appTransportSecuritySettings
然后对字典和它的值执行很多NSDictionary *atsSettingsDictionary = [NSBundle mainBundle].infoDictionary[kMoPubAppTransportSecurityDictionaryKey];
操作
结论:[]
中的一个在需要字典时碰到字符串。
关于swift - Swift:是否终止了NSExeption的应用程序?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40794842/