每当我尝试在文本字段上书写时,我都会遇到这个奇怪的错误,使用我的应用程序会崩溃。
-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x108e3eaf0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x108e3eaf0'
我搜索了这个问题,但实在不明白为什么会出现这种情况?
有人可以帮助我吗?
这是完整的错误..
-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10450caf0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10450caf0'
*** First throw call stack:
(
0 CoreFoundation 0x00000001042e7e65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x0000000103d60deb objc_exception_throw + 48
2 CoreFoundation 0x00000001042f048d -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
3 CoreFoundation 0x000000010423d90a ___forwarding___ + 970
4 CoreFoundation 0x000000010423d4b8 _CF_forwarding_prep_0 + 120
5 CoreFoundation 0x00000001042d3f23 -[NSTaggedPointerString compare:options:range:locale:] + 243
6 Foundation 0x00000001034d6e37 -[NSString compare:options:range:] + 29
7 UIKit 0x000000010497ee6f -[UIPhysicalKeyboardEvent _matchesKeyCommand:] + 303
8 UIKit 0x00000001048a33fd -[UIResponder _keyCommandForEvent:target:] + 364
9 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
10 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
11 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
12 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
13 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
14 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
15 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
16 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
17 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
18 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
19 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
20 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
21 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
22 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
23 UIKit 0x00000001048a35b2 -[UIResponder _keyCommandForEvent:target:] + 801
24 UIKit 0x00000001046b51aa -[UIApplication handleKeyHIDEvent:] + 397
25 UIKit 0x000000010468e838 _UIApplicationHandleEventQueue + 5469
26 CoreFoundation 0x0000000104213a31 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
27 CoreFoundation 0x000000010420995c __CFRunLoopDoSources0 + 556
28 CoreFoundation 0x0000000104208e13 __CFRunLoopRun + 867
29 CoreFoundation 0x0000000104208828 CFRunLoopRunSpecific + 488
30 GraphicsServices 0x0000000108449ad2 GSEventRunModal + 161
31 UIKit 0x0000000104694610 UIApplicationMain + 171
32 Parents-Baby Link 0x0000000102241dfd main + 109
33 libdyld.dylib 0x00000001066f292d start + 1
34 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
好的,有一种解决方案可能适合您,请尝试将文本字段放入初始视图控制器中,并检查应用程序是否崩溃(如果应用程序在键入时没有崩溃)尝试以下操作:
由于某种原因,我使用的标签栏控制器导致了问题。只需删除控制器,然后转到“编辑器”>“嵌入”>“选项卡栏控制器”并重新添加视图即可修复此问题。Ref https://stackoverflow.com/questions/36245400/typing-in-any-text-field-crashes-app#comment60120887_36245400
另一个问题可能是在文本字段中传递的数据不是有效格式,可能为空或具有除字符串之外的无效格式
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)