title: My app works perfect in debug mode but not in ad hoc mode
body: <p>My app works fine in debug mode, with the simulator or the device pluged to the computer, and when I generate the app for ad hoc and install it in the device, it crashes a lot in random way. Btw, the app is made with Cordova and has background tasks(it's a geolocation app)</p>
  
  <p>Crash example:</p>
  
  <pre><code>Exception Type:  00000020
  Exception Codes: 0x000000008badf00d
  Highlighted Thread:  2
  
  Application Specific Information:
  &lt;BKNewProcess: 0x1758f950; com.app; pid: 2675; hostpid: -1&gt; has active assertions beyond permitted time: 
  {(
      &lt;BKProcessAssertion: 0x17692970&gt; id: 2675-CA057A50-06BF-4BA1-9F0C-7641112B945E name: Called by MyApp, from unknown method process: &lt;BKNewProcess: 0x1758f950; gbi.cro; pid: 2675; hostpid: -1&gt; permittedBackgroundDuration: 180.000000 reason: finishTask owner pid:2675 preventSuspend  preventIdleSleep  preventSuspendOnSleep ,
      &lt;BKProcessAssertion: 0x17697c30&gt; id: 2675-A03FFC10-1D0A-4BDC-BF64-61358346530E name: Called by MyApp, from unknown method process: &lt;BKNewProcess: 0x1758f950; gbi.cro; pid: 2675; hostpid: -1&gt; permittedBackgroundDuration: 180.000000 reason: finishTask owner pid:2675 preventSuspend  preventIdleSleep  preventSuspendOnSleep 
  )}
  </code></pre>
  
  <p>And the thread 2 is: </p>
  
  <pre><code>Thread 2 name:  com.apple.NSURLConnectionLoader
  Thread 2:
  0   libsystem_kernel.dylib          0x30ae3518 mach_msg_trap + 20
  1   libsystem_kernel.dylib          0x30ae330c mach_msg + 36
  2   CoreFoundation                  0x227d1596 __CFRunLoopServiceMachPort + 142
  3   CoreFoundation                  0x227cfb5c __CFRunLoopRun + 1012
  4   CoreFoundation                  0x2271cb2c CFRunLoopRunSpecific + 472
  5   CoreFoundation                  0x2271c93e CFRunLoopRunInMode + 102
  6   CFNetwork                       0x222d178a +[NSURLConnection(Loader) _resourceLoadLoop:] + 482
  7   Foundation                      0x2351e996 __NSThread__main__ + 1114
  8   libsystem_pthread.dylib         0x30b75e64 _pthread_body + 136
  9   libsystem_pthread.dylib         0x30b75dd6 _pthread_start + 114
  10  libsystem_pthread.dylib         0x30b73b80 thread_start + 4
  </code></pre>
  
  <p>I've the whole trace but it's so big, so if someone needs some information, let me know.</p>
  
  <p>Any idea what is it going on?</p>
  
  <p>Thanks </p>