dispatch_sync on main queue hangs in unit test

前端 未结 5 1101
太阳男子
太阳男子 2020-12-02 11:08

I was having some trouble unit testing some grand central dispatch code with the built in Xcode unit testing framework, SenTestingKit. I managed to boil my problem done to t

5条回答
  •  我在风中等你
    2020-12-02 11:39

    If you are on the main queue and synchronously wait for the main queue to be available you will indeed wait a long time. You should test to make sure you are not already on the main thread.

提交回复
热议问题