任何人都知道为什么我在NSURLSession中遇到这种崩溃

时间:2015-04-10 09:19:59

标签: ios objective-c iphone upload nsurlsession

使用此堆栈跟踪获取大量崩溃报告...无法修复它。 有人怀疑它与我在NSHTTPCookieStorage的共享实例中操作cookie有关,所以我已经在同一个线程上添加了代码来执行它,但我仍然在使用它。 任何想法或想法将不胜感激。

Thread 4 Crashed:
0   CoreFoundation                       0x23363dc4 CFURLCopyAbsoluteURL + 60
1   CFNetwork                            0x22e87039 HTTPCookieStorage::copyCookiesForURL(__CFURL const*, unsigned char) + 74
2   CFNetwork                            0x22f65ed1 -[NSHTTPCookieStorage cookiesForURL:] + 90
3   CFNetwork                            0x22eef4e1 -[__NSURLBackgroundSession requestWithCookiesApplied:] + 218
4   CFNetwork                            0x22ef0505 -[__NSURLBackgroundSession _onqueue_uploadTaskForRequest:uploadFile:bodyData:completion:] + 126
5   CFNetwork                            0x22ef03e5 __80-[__NSURLBackgroundSession uploadTaskForRequest:uploadFile:bodyData:completion:]_block_invoke + 38
6   CFNetwork                            0x22eefadf __68-[__NSURLBackgroundSession performBlockOnQueueAndRethrowExceptions:]_block_invoke + 84
7   libdispatch.dylib                    0x31577c6f _dispatch_client_callout + 20
8   libdispatch.dylib                    0x31581559 _dispatch_barrier_sync_f_invoke + 46
9   CFNetwork                            0x22eefa0f -[__NSURLBackgroundSession performBlockOnQueueAndRethrowExceptions:] + 208
10  CFNetwork                            0x22ef0365 -[__NSURLBackgroundSession uploadTaskForRequest:uploadFile:bodyData:completion:] + 218
11  CFNetwork                            0x22f497b7 -[NSURLSession uploadTaskWithRequest:fromFile:] + 32
12  Pogoplug                             0x001a3ca5 __46-[CENetworkManager uploadRequest:finishBlock:]_block_invoke (CENetworkManager.m:377)
13  Foundation                           0x2414abfd __NSBLOCKOPERATION_IS_CALLING_OUT_TO_A_BLOCK__ + 6
14  Foundation                           0x240b5ac5 -[NSBlockOperation main] + 146
15  Foundation                           0x240a8505 -[__NSOperationInternal _start:] + 766
16  Foundation                           0x2414d557 __NSOQSchedule_f + 184
17  libdispatch.dylib                    0x315824d3 _dispatch_queue_drain$VARIANT$mp + 1460
18  libdispatch.dylib                    0x31581da1 _dispatch_queue_invoke$VARIANT$mp + 82
19  libdispatch.dylib                    0x31584491 _dispatch_root_queue_drain + 386
20  libdispatch.dylib                    0x315858a3 _dispatch_worker_thread3 + 104
21  libsystem_pthread.dylib              0x316f8da9 _pthread_wqthread + 666
22  libsystem_pthread.dylib              0x316f8afc start_wqthread + 6

2 个答案:

答案 0 :(得分:0)

我在调试时设法重现了这个问题后终于找到了原因,而且我这么傻 - 它发生在url == nil for upload request时。

不确定为什么Apple允许使用url == nil创建NSURLMutableRequest,而不是在[NSMutableURLRequest requestWithURL:]方法中抛出异常。

答案 1 :(得分:-2)

我建议您使用“仪器工具”检查一次,您将清楚地了解它为何以及在何处崩溃。