草庐IT

CustomOperation

全部标签

ios - NSOperationQueue 和传递数据

在我的应用程序中,我的主文件创建了一个类的新实例,然后使用NSOperationQueue在后台运行类函数,如下所示:NSOperationQueuebackgroundQueue=[NSOperationQueuenew];MyClassmc=[MyClassalloc];NSInvocationOperation*operation=[[NSInvocationOperationalloc]initWithTarget:mcselector:@selector(runEvents)object:nil];[backgroundQueueaddOperation:operation]