0

When i run my app using breakpoint it runs fine and gives no error,but when i remove breakpoint and rut,it crashes.And it doesn't crash on simulator and crashes on device.So in this case how to find error?

sp309
  • 150
  • 1
  • 10

3 Answers3

0

It's a thread issue .. try to

runOnMainQueueWithoutDeadlockingUpload(^{


    //Do stuff
      });

void runOnMainQueueWithoutDeadlockingUpload(void (^block)(void))
{
    if ([NSThread isMainThread])
    {
        block();
    }
    else
    {
        dispatch_sync(dispatch_get_main_queue(), block);
    }
}

for heavy task you doing while starting the app.

vivek
  • 459
  • 3
  • 14
  • i have checked multiple times.it crashes when running directly but when i use breakpoint it doesn't crash. – sp309 Feb 22 '17 at 06:26
  • @VishalSonawane because when puts breakpoint the task in the background thread finishes and hence it is not crashing on the other hand when he runs in the real time background which may be giving some data is not finished yet. hence crashes.. – vivek Feb 22 '17 at 07:02
  • @vivek unsubscribe failed with error: (Error Domain=OTSessionErrorDomain Code=1112 "(null)") – sp309 Feb 22 '17 at 07:07
  • https://tokbox.com/developer/sdks/ios/reference/Constants/OTSessionErrorCode.html check this out for error code 1112 and see what's missing in your code – vivek Feb 22 '17 at 07:14
  • i already visited this link.but how can i get solution form that? – sp309 Feb 22 '17 at 08:49
0

it is very simple when u put break point it is not crash and without breakpoint it is crash so what code u are execute put some delay then it will resolve

 double delayInSeconds = 1.0;
    dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
    dispatch_after(popTime, dispatch_get_main_queue(), ^(void){

// Add Your code here

});
Ravi Panchal
  • 1,285
  • 10
  • 22
0

Something happening wrong in async thread and in special cases other thread do work slowly! You need check these cases.