title: What causes apps to crash on resume after a long time in background?
body: <p>I'm finding that after my app has been in the background for a while, (half hour + maybe) it crashes immediately on resume.</p>
  
  <p>Crash log reveals that it is EXC_BAD_ACCESS, but I'm at loss for how to debug this one, because I don't know what gets released when my app goes to background (for a long time in particular). (Exception codes are 0x0000000 repeated)</p>
  
  <p>Is there any documentation on this / can anyone give insight about what they did to fix this in the past?</p>
  
  <p>While we're at it, is there a way to test this without waiting for hours before each try? Some way to simulate whatever it is that is happening to my app?</p>
  
  <p>Thanks</p>
  
  <h2>Update</h2>
  
  <p>I just read a bit more closely, and there's something here about a timer, I added some stuff that uses timers recently to my app, could this give more info? (See item 12)</p>
  
  <pre><code>Thread 0 name:  Dispatch queue: com.apple.main-thread
  Thread 0 Crashed:
  0   libsystem_kernel.dylib          0x32858a1c __pthread_kill + 8
  1   libsystem_c.dylib               0x337013b4 pthread_kill + 52
  2   libsystem_c.dylib               0x336f9bf8 abort + 72
  3   libstdc++.6.dylib               0x30504a64 __gnu_cxx::__verbose_terminate_handler() + 376
  4   libobjc.A.dylib                 0x3068f06c _objc_terminate + 104
  5   libstdc++.6.dylib               0x30502e36 __cxxabiv1::__terminate(void (*)()) + 46
  6   libstdc++.6.dylib               0x30502e8a std::terminate() + 10
  7   libstdc++.6.dylib               0x30502f5a __cxa_throw + 78
  8   libobjc.A.dylib                 0x3068dc84 objc_exception_throw + 64
  9   MarsCrash                       0x0000be88 0x1000 + 44680
  10  MarsCrash                       0x00020646 0x1000 + 128582
  11  Foundation                      0x327196ce __NSFireDelayedPerform + 362
  12  CoreFoundation                  0x334e7a40 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
  13  CoreFoundation                  0x334e9ec4 __CFRunLoopDoTimer + 844
  14  CoreFoundation                  0x334ea83e __CFRunLoopRun + 1082
  15  CoreFoundation                  0x3347aebc CFRunLoopRunSpecific + 224
  16  CoreFoundation                  0x3347adc4 CFRunLoopRunInMode + 52
  17  GraphicsServices                0x311a5418 GSEventRunModal + 108
  18  GraphicsServices                0x311a54c4 GSEventRun + 56
  19  UIKit                           0x31b90d62 -[UIApplication _run] + 398
  20  UIKit                           0x31b8e800 UIApplicationMain + 664
  21  MarsCrash                       0x00002558 0x1000 + 5464
  22  MarsCrash                       0x00002500 0x1000 + 5376
  </code></pre>