1

Block of Code has to be run on the Background Thread. So structure of the App is:

PARENT CLASS (ABSTRACT METHOD)
CHILD CLASS (ABSTRACT METHOD IMPLEMENTATION)

CHILD CLASS: Method Call has been surrounded by:

   dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, (unsigned long)NULL), ^(void) {}

PROBLEM: Still it runs on the Main Thread. if i put Sleep(20) it block the Main UI for 20 sec. Block of Code is DB insertions & Web Call.

Please suggest what can be the Problem.

Appoorva Faldu
  • 344
  • 4
  • 17
  • Hi. Trying to help but need more context. Can you provide some more code please? – Michal Shatz Jun 25 '14 at 09:12
  • 1
    Are you sure it runs on the main thread? Rather than sleeping add the following within the block: `NSLog(@"Main thread? %@", [NSThread isMainThread] ? @"Yes" : @"No");`. – trojanfoe Jun 25 '14 at 09:13

0 Answers0