Bug 1 fixed.

What was the root cause of the bug?
printTextInMain function is using dispatch_sync and trying to dispatch synchronous task to the main queue. As it is synchronous it needs to complete for code to continue, but it is executed on the main thread which is causing dispatch_get_main_queue to block. 

How did you fix the problem?
Instead of using dispatch_sync I used  dispatch_async and lets the background queue dispatch to the main queue.