3

I have a request manager class that is initialized in applicationDidFinishLaunching:, and creates an NSURLSession like so:

NSURLSessionConfiguration* config = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:@"myqueue"];
self.urlSession = [NSURLSession sessionWithConfiguration:config delegate:self delegateQueue:[NSOperationQueue mainQueue]];

We recently got a crash log from a user that was blocked on the second line (call to sessionWithConfiguration:, that had caused our application to be killed by SPRINGBOARD with code 0x8badf00d, so our application was taking too long to start.

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)

So it was blocked on AppStorePurchase.m line 60, which is where we create the NSURLSession.

Is this method supposed to block? I had always assumed this was fairly lightweight until you actually started performing some requests.

First observed on iOS 10.2.1.

yano
  • 4,095
  • 3
  • 35
  • 68
  • you mean in AppStorePurchase.m you call the request not the session right? – hasan Mar 24 '17 at 22:42
  • where do you initialise the AppStorePurchase object? is it a singlton object? or does it exist in a singlton object? or its just a viewcontroller? – hasan Mar 24 '17 at 22:47
  • it is a normal object that is owned by a singleton which manages all of our IAP content. This class is responsible for downloading content 1 item at a time. We only create the session on init, and do not do any requests until after the app is done launching – yano Mar 24 '17 at 23:56

0 Answers0