Pass data from NSOperation to next NSOperation

时光怂恿深爱的人放手 提交于 2019-12-06 03:59:53

问题


Is it possible to pass data from an NSOperation up the dependency chain to be used by the next NSOperation?

Thanks

Chris


回答1:


Yes. The current NSOperation can access it's dependancies via the dependencies method:

NSArray *myDependancies = [self dependencies];

It can then access whatever properties you wish on the previous operations and pull out any data it requires.

In a recent project I found that I needed to pass data along so often that I created a subclass of NSOperation that automatically carried forward an NSDictionary of data from one operation to the next.



来源:https://stackoverflow.com/questions/17402283/pass-data-from-nsoperation-to-next-nsoperation

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