Background Thread to Call Methods

て烟熏妆下的殇ゞ 提交于 2019-12-20 06:10:10

问题


I've found this method to work with background thread. My question is that I've run a whole process in background thread which include number of methods. Frist method calls the second one and the the second one makes some data and pass it to the third one.

-(void)firstMethod
    dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(void){

      if(someCondition == 0)
      {
        [self secondMethod:myArray];
      }
    }
       dispatch_async(dispatch_get_main_queue(), ^(void){

        [self.navigationController popViewControllerAnimated:YES];
            });
    });
}
    -(void)secondMethod:(NSArray *)array {
       a= a+3;
       [self thirdMethod:array[a];
    }

So you get the general idea right? So do I have to put the functionality of second and third method in background thread too? Or how this whole process will take place?

来源:https://stackoverflow.com/questions/40504453/background-thread-to-call-methods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!