Closed xueminghao closed 5 years ago
该问题的重现步骤是什么? 线上概率崩溃
崩溃栈如下:
Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x226d3cec4 exceptionPreprocess 1 libobjc.A.dylib 0x225f0da40 objc_exception_throw 2 CoreFoundation 0x226c43594 -[NSCache init] 3 Foundation 0x2276fddb8 +[NSJSONSerialization JSONObjectWithData:options:error:] 4 ClubFactory 0x100f1a6cc -[SonicCache updateWithJsonData:withHtmlString:withResponseHeaders:withUrl:] (SonicCache.m:344) 5 ClubFactory 0x100f2964c -[SonicSession dealWithDataUpdate] (SonicSession.m:817) 6 ClubFactory 0x100f28b58 -[SonicSession updateDidSuccess] (SonicSession.m:708) 7 ClubFactory 0x100f27304 46-[SonicSession serverDidCompleteWithoutError:]_block_invoke (SonicSession.m:401) 8 Foundation 0x2277cc8bc NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK 9 Foundation 0x2276d4ab8 -[NSBlockOperation main] 10 Foundation 0x2276d3f8c -[__NSOperationInternal _start:] 11 Foundation 0x2277ce790 __NSOQSchedule_f 12 libdispatch.dylib 0x2267756c8 _dispatch_call_block_and_release 13 libdispatch.dylib 0x226776484 _dispatch_client_callout 14 libdispatch.dylib 0x22671982c _dispatch_continuation_pop$VARIANT$mp 15 libdispatch.dylib 0x226718ef4 _dispatch_async_redirect_invoke 16 libdispatch.dylib 0x226725a18 _dispatch_root_queue_drain 17 libdispatch.dylib 0x2267262c0 _dispatch_worker_thread2 18 libsystem_pthread.dylib 0x22695917c _pthread_wqthread 19 libsystem_pthread.dylib 0x22695bcec start_wqthread
怀疑是JSONObjectWithData传入了空的jsonData值。
if (jsonData) { dataDict = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingAllowFragments error:&err]; }
代码做了为空判断,怀疑可能是其他线程释放了jsonData引起。
该问题的重现步骤是什么? 线上概率崩溃
崩溃栈如下:
Fatal Exception: NSInvalidArgumentException 0 CoreFoundation 0x226d3cec4 exceptionPreprocess 1 libobjc.A.dylib 0x225f0da40 objc_exception_throw 2 CoreFoundation 0x226c43594 -[NSCache init] 3 Foundation 0x2276fddb8 +[NSJSONSerialization JSONObjectWithData:options:error:] 4 ClubFactory 0x100f1a6cc -[SonicCache updateWithJsonData:withHtmlString:withResponseHeaders:withUrl:] (SonicCache.m:344) 5 ClubFactory 0x100f2964c -[SonicSession dealWithDataUpdate] (SonicSession.m:817) 6 ClubFactory 0x100f28b58 -[SonicSession updateDidSuccess] (SonicSession.m:708) 7 ClubFactory 0x100f27304 46-[SonicSession serverDidCompleteWithoutError:]_block_invoke (SonicSession.m:401) 8 Foundation 0x2277cc8bc NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK 9 Foundation 0x2276d4ab8 -[NSBlockOperation main] 10 Foundation 0x2276d3f8c -[__NSOperationInternal _start:] 11 Foundation 0x2277ce790 __NSOQSchedule_f 12 libdispatch.dylib 0x2267756c8 _dispatch_call_block_and_release 13 libdispatch.dylib 0x226776484 _dispatch_client_callout 14 libdispatch.dylib 0x22671982c _dispatch_continuation_pop$VARIANT$mp 15 libdispatch.dylib 0x226718ef4 _dispatch_async_redirect_invoke 16 libdispatch.dylib 0x226725a18 _dispatch_root_queue_drain 17 libdispatch.dylib 0x2267262c0 _dispatch_worker_thread2 18 libsystem_pthread.dylib 0x22695917c _pthread_wqthread 19 libsystem_pthread.dylib 0x22695bcec start_wqthread
怀疑是JSONObjectWithData传入了空的jsonData值。
代码做了为空判断,怀疑可能是其他线程释放了jsonData引起。