[NSNull intValue]: unrecognized selector sent to instance 0x375c9860

今天遇到这个问题,程序崩溃了……日志如下:

-[NSNull intValue]: unrecognized selector sent to instance 0x375c9860
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull intValue]: unrecognized selector sent to instance 0x375c9860' *** First throw call stack: (0x287910d7 0x36c23c77 0x2879659d 0x28794479 0x286c3708 0x17661 0x7d4fd 0x7f419b 0x7f4187 0x7f7e9d 0x28756669 0x28754d89 0x286a06d1 0x286a04e3 0x300651a9 0x2be52445 0xca0c5 0x371f1aaf) libc++abi.dylib: terminating with uncaught exception of type NSException (lldb)

而 crash 的时候线程停在了这里:

右侧代码出现了 "Thread 1: signal SIGABRT",如图所示:

出现“unrecognized selector sent to instance”问题原因之一及解决方法 该文介绍了一种方法,不过还是没解决我的问题。

目前寻找在路上…… 

———————————————这是分割线—————————————————————

今天测试,报的错还是那样,但又出现了新的错误内容,如下:

[NSNull intValue]: unrecognized selector sent to instance 0x1095444c0
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull intValue]: unrecognized selector sent to instance 0x1095444c0'
*** First throw call stack:
(
	0   CoreFoundation                      0x0000000109298c65 __exceptionPreprocess + 165
	1   libobjc.A.dylib                     0x0000000108b46bb7 objc_exception_throw + 45
	2   CoreFoundation                      0x00000001092a00ad -[NSObject(NSObject) doesNotRecognizeSelector:] + 205
	3   CoreFoundation                      0x00000001091f613c ___forwarding___ + 988
	4   CoreFoundation                      0x00000001091f5cd8 _CF_forwarding_prep_0 + 120
	5   NetloanRoad                         0x0000000105e4322e __32-[goingOnViewController request]_block_invoke_2 + 3310
	6   NetloanRoad                         0x0000000105eb8278 __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke46 + 40
	7   libdispatch.dylib                   0x000000010b299186 _dispatch_call_block_and_release + 12
	8   libdispatch.dylib                   0x000000010b2b8614 _dispatch_client_callout + 8
	9   libdispatch.dylib                   0x000000010b2a0a1c _dispatch_main_queue_callback_4CF + 1664
	10  CoreFoundation                      0x00000001092001f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
	11  CoreFoundation                      0x00000001091c1dcb __CFRunLoopRun + 2043
	12  CoreFoundation                      0x00000001091c1366 CFRunLoopRunSpecific + 470
	13  GraphicsServices                    0x000000010b97da3e GSEventRunModal + 161
	14  UIKit                               0x0000000109db78c0 UIApplicationMain + 1282
	15  NetloanRoad                         0x0000000105f0dd1f main + 111
	16  libdyld.dylib                       0x000000010b2ec145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) 

我只能自己说:编程就是在不断的出现 bug,解决 bug 中成长进步的……

Stack Overflow 上有个链接有参考价值:Only iOS 7 crash [NSNull intValue]: unrecognized selector sent to instance 虽然没解决我的问题。

后来注释掉报错的那段代码,然后问题就这么解决了……测试后发现那段代码是多余的……

原文地址:https://www.cnblogs.com/jaxer/p/4787486.html