moving a function to a background thread in objective c

后端 未结 2 1199
有刺的猬
有刺的猬 2021-01-30 07:15

I have a function that returns a string that takes 15 seconds to compute on an iPhone.

I want to be able to run the function on the background thread so that the main t

2条回答
  •  猫巷女王i
    2021-01-30 07:40

    Also to add, sometimes you don't need to use GCD, this one is very simple to use :

    [self performSelectorInBackground:@selector(someMethod:) withObject:nil];
    

提交回复
热议问题