GCD vs performSelectorInBackground/performSelectorOnMainThread

后端 未结 2 776
天涯浪人
天涯浪人 2020-12-08 05:30

I am new in ios development. I have following questions:

  1. When we use GCD(dispatch_group_async, dispatch_async(dispatch_get_main_queue()...) and when we use per
2条回答
  •  粉色の甜心
    2020-12-08 05:57

    Actually after iOS 4.0 I can't find any single reason to use performSelectorInBackground/onMainThread. If you need to do something in background, use GCD( or, better, NSOperationQueue which is built on top of GCD since 4.0 and gives greater flexibility with little overhead), but be sure not to create retain cycles when using blocks.

提交回复
热议问题