Because dispatch_sync queues a function and blocks the current thread until the function executes and returns a value. Thus, if you do dispatch_sync on the current thread, you will get a deadlock - the current function waits for a response from a function that cannot start until the current function has completed.
From the apple documentation :
Submits a block to a dispatch queue for synchronous execution. Unlike dispatch_async, this function doesn’t return until the block has finished. Calling this function and targeting the current queue results in deadlock.
return YES;, it falls, and ifdispatch_asyncdoes, does it not fall? What error falls? - markovdispatch_sync. - Seryozha Kvyatkovskiy