任何人都知道为什么我在 NSURLSession 中遇到此崩溃
Anyone has a clue why I'm experiencing this crash in 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
我建议使用 Instruments Tool 检查一次,您将清楚地了解它崩溃的原因和确切位置。
我在调试时设法重现了这个问题后终于找到了原因,这对我来说太愚蠢了——它发生在上传请求 url == nil 时。
不确定为什么 Apple 允许使用 url == nil 创建 NSURLMutableRequest
,并且不在 [NSMutableURLRequest requestWithURL:]
方法中抛出异常。
收到大量关于此堆栈跟踪的崩溃报告...无法修复。 怀疑它与我在 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
我建议使用 Instruments Tool 检查一次,您将清楚地了解它崩溃的原因和确切位置。
我在调试时设法重现了这个问题后终于找到了原因,这对我来说太愚蠢了——它发生在上传请求 url == nil 时。
不确定为什么 Apple 允许使用 url == nil 创建 NSURLMutableRequest
,并且不在 [NSMutableURLRequest requestWithURL:]
方法中抛出异常。