NSOperation on the iPhone

前端 未结 7 637
攒了一身酷
攒了一身酷 2020-11-28 19:54

I\'ve been looking for some concrete scenarios for when NSOperation on the iPhone is an ideal tool to use in an application. To my understanding, this is a wrap

7条回答
  •  [愿得一人]
    2020-11-28 20:05

    In a word: NSOperationQueue

    NSOperationQueue is thread safe (you can add operations to it from different threads without the need for locks) and enables you to chain NSOp objects together.

    My Flickr iPhone app, Reflections, uses NSOperation and NSOperationQueue extensively to manage downloading images and XML.

    Caveat: Make sure you read, re-read, and understand what the docs mean when they talk about 'concurrency'.

提交回复
热议问题