我有一个在applicationDidFinishLaunching:
初始化的请求管理器类,并像这样创建NSURLSession
:
NSURLSessionConfiguration* config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"myqueue"];
self.urlSession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue mainQueue]];
我们最近收到了第二行阻止的用户的崩溃日志(调用sessionWithConfiguration:
,导致我们的应用程序被SPRINGBOARD用代码0x8badf00d
杀死,所以我们的应用程序是花了太长时间才开始。
Call stack:Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: Namespace SPRINGBOARD, Code 0x8badf00d
Triggered by Thread: 0
Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 libsystem_kernel.dylib 0x00000001854e51c4 0x1854e4000 + 4548
1 libdispatch.dylib 0x00000001853d07d8 0x1853bd000 + 79832
2 CFNetwork 0x0000000186c192d0 0x186b34000 + 938704
3 CFNetwork 0x0000000186c18850 0x186b34000 + 936016
4 CFNetwork 0x0000000186d00858 0x186b34000 + 1886296
5 Redacted 0x000000010016e07c -[AppStorePurchase init] (AppStorePurchase.m:60)
---snip----
12 Redacted 0x0000000100127704 -[AppDelegatePhone application:didFinishLaunchingWithOptions:] (AppDelegatePhone.mm:52)
因此它在AppStorePurchase.m第60行被阻止,这是我们创建NSURLSession
的地方。
这种方法应该阻止吗?在你真正开始执行某些请求之前,我一直认为这是相当轻量级的。
首先在iOS 10.2.1上观察。