Saturday, December 24, 2011

A paragraph about Networking and Multitasking in Objective-C


There are a number of ways in iOS in which networking can be handled. Perhaps the simplest method would be using initialization with contents of URL in classes such as NSString, arrays and dictionaries. Moreover, it provides classes including NSURLConnection which basically allows network operations to be handled in the background. There are also other libraries such as ASIHTTPRequest (not an Apple library) that provide an acceptable range of functionalities to implement networking. ASIHTTPRequest also allows the user to choose if an operation should run in background or on the main thread.  Therefore, when developing network based applications, user rarely needs to explicitly indicate that an operation should be performed in background. Nevertheless, as part of support for multitasking in Mac OS X and iOS, Objective C offers using NSObject “performSelector:onThread” and “performSelectorInBackground” methods as well as operation and queue classes. NSThread class can also be taken advantage of. However, it is not encouraged by Apple especially for those who are about to implement a new application and who are not quite familiar with threading design techniques (instead, easier-to-use and more sophisticated operation and queue classes are encouraged).

No comments:

Post a Comment