IOS多執行緒

IOS多執行緒

关于iOS多线程,你看我就够了
http://www.jianshu.com/p/0b0d9b1f1f19
NSURLSession 教程
http://www.jianshu.com/p/045cdfdaaf6e
NSURLSession with NSBlockOperation and queues
http://stackoverflow.com/questions/21198404/nsurlsession-with-nsblockoperation-and-queues
iOS 並行程式設計: 初探 NSOperation 和 Dispatch Queues
http://www.appcoda.com.tw/ios-concurrency/
background-transfer-service-ios7
http://www.appcoda.com/background-transfer-service-ios7/
Parsing JSON in Swift
http://chris.eidhof.nl/post/json-parsing-in-swift/
How do I use NSOperationQueue with NSURLSession?
http://stackoverflow.com/questions/21918722/how-do-i-use-nsoperationqueue-with-nsurlsession

Operation Queues

Cocoa operations are an object-oriented way to encapsulate work that you want to perform asynchronously. Operations are designed to be used either in conjunction with an operation queue or by themselves. Because they are Objective-C based, operations are most commonly used in Cocoa-based applications in OS X and iOS.

This chapter shows you how to define and use operations.

作業序列

Cocoa是一個物件導向的方式封裝要異步執行的工作。被設計無論是在與操作序列結合或本身使用。因為他們是Objective-C的基礎,作業在OS X和iOS基於Cocoa的應用程序最常用的。

本章介紹如何定義和使用操作。

About Operation Objects

An operation object is an instance of the NSOperation class (in the Foundation framework) that you use to encapsulate work you want your application to perform. The NSOperation class itself is an abstract base class that must be subclassed in order to do any useful work. Despite being abstract, this class does provide a significant amount of infrastructure to minimize the amount of work you have to do in your own subclasses. In addition, the Foundation framework provides two concrete subclasses that you can use as-is with your existing code. Table 2-1 lists these classes, along with a summary of how you use each one

關於作業物件

作業物件是的NSOperation類別的一個實體(在Foundation框架),您使用封裝來執行你的應用程式。在類別中的NSOperation本身是一個抽象基礎,這樣才能保證做任何有用的工作被繼承。儘管是抽象的,這個類提供的大量基礎框架,以減少子類的實作。此外,基礎框架提供了兩種可以使用的具體子類別可用在您的現存程式碼,與您現有的代碼具體子類。表2-1列出了這些類,沿著這張表來找尋您可用的類別

Table 2-1 Operation classes of the Foundation framework

NSInvocationOperation
A class you use as-is to create an operation object based on an object and selector from your application. You can use this class in cases where you have an existing method that already performs the needed task. Because it does not require subclassing, you can also use this class to create operation objects in a more dynamic fashion.
For information about how to use this class, see Creating an NSInvocationOperation Object.

NSInvocationOperation
您可以使用類,是創建一個基於從應用程序中的對象和選擇上的操作對象。你可以使用這個類,你必須已經完成所需的任務,現有方法的情況。因為它不需要子類,你也可以使用這個類在一個更加彈性現代,以創建操作對象。
有關如何使用這個類的信息,請參閱創建NSInvocationOperation對象。

NSBlockOperation
A class you use as-is to execute one or more block objects concurrently. Because it can execute more than one block, a block operation object operates using a group semantic; only when all of the associated blocks have finished executing is the operation itself considered finished.
For information about how to use this class, see Creating an NSBlockOperation Object. This class is available in OS X v10.6 and later. For more information about blocks, see Blocks Programming Topics.

您可以使用類,是同時執行一個或多個模塊中的對象。由於它可以執行多個塊,塊操作對象進行操作使用一組語義;只有當所有相關的塊已完成執行的是操作本身視為完成。
有關如何使用這個類的信息,請參閱創建NSBlockOperation物件。這個類是在OS X v10.6中及更高版本。有關塊的詳細信息,請參閱模塊編程主題。

NSOperation
The base class for defining custom operation objects. Subclassing NSOperation gives you complete control over the implementation of your own operations, including the ability to alter the default way in which your operation executes and reports its status.
For information about how to define custom operation objects, see Defining a Custom Operation Object.

該基類定義自定義操作的對象。子類的NSOperation讓您對您自己操作的實現,包括改變在您的操作執行,並報告其狀態的默認方式的完全控制。
有關如何定義自定義操作對象,請參閱定義自定義操作對象的信息。

Comments

Popular posts from this blog

MEGA 暫存檔案刪除

IOS GCD多執行緒

利用CMD指令強制刪除