8

I integrated the latest version of Google Analytics SDK. I use silent notifications in my app. So I need a little time for background tasks(about 30 seconds). I see many crashes connected with permitted time.

My App[3114] has active assertions beyond permitted time: 
{(
    <BKProcessAssertion: 0x15699c00> identifier: Background Content Fetching (15) process: MyApp [3114] permittedBackgroundDuration: 30.000000 reason: backgroundContentFetching owner   
    pid:3101 preventSuspend  preventThrottleDownUI  preventIdleSleep  preventSuspendOnSleep 
)}

I see tha app is crashing with the following stack on [GAI threadMain]:

Thread 2:
0   libsystem_kernel.dylib          0x3b47ca58 mach_msg_trap + 20
1   libsystem_kernel.dylib          0x3b47c854 mach_msg + 44
2   CoreFoundation                  0x3074c896 __CFRunLoopServiceMachPort + 150
3   CoreFoundation                  0x3074afbc __CFRunLoopRun + 780
4   CoreFoundation                  0x306b5f0a CFRunLoopRunSpecific + 518
5   CoreFoundation                  0x306b5cee CFRunLoopRunInMode + 102
6   Foundation                      0x310a81e6 -[NSRunLoop(NSRunLoop) runMode:beforeDate:] + 250
7   Foundation                      0x310f909c -[NSRunLoop(NSRunLoop) run] + 76
8   MyApp                           0x0016df5c +[GAI threadMain:] + 60
9   Foundation                      0x3116aa5a __NSThread__main__ + 1058
10  libsystem_pthread.dylib         0x3b4f8916 _pthread_body + 138
11  libsystem_pthread.dylib         0x3b4f8886 _pthread_start + 98
12  libsystem_pthread.dylib         0x3b4f6aa0 thread_start + 4

I think that crash is connected with Google Analytics, I tried switch off Google Analytics on remote push like this:

  - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo
    fetchCompletionHandler:(BackgroundFetchResultBlock)completionHandler {
  ...
  [GAI sharedInstance].optOut = YES;

but it doesn't help.

ArisRS
  • 1,362
  • 2
  • 19
  • 41
  • Thread 2 looks like it is just waiting to receive an event to process. Is there a "highlighted thread" in the crash log? – Walt Sellers Nov 16 '14 at 06:41
  • @Romula Did you ever resolve this? We're seeing this now, and we've redone our backgrounding, but still being snakebitten by GA – Mike Welsh Nov 17 '15 at 12:56

1 Answers1

0

See this SO answer. In short, the problem is that your background task ran longer than the permitted amount of time. The allowed background time was shortened significantly since iOS6; you may have to revisit your design and make adjustments.

Community
  • 1
  • 1
Olie
  • 24,597
  • 18
  • 99
  • 131