0

I'm really new to IOS, in Android, I have a parent class Parent to define the basic http communication class, and a couple of subclasses(child1, child2) to really implement the functions.

Then put children (Parent p = new Child(xxx)) to ASyncTask(Parent xxx, xxxxx) and run it in doInBackground, then in onPostExecute, use some interfaces to update UI or do some other jobs.

So anyone knows how to implement similar structures in ios, I'll use AFNetworking-2.0 as networking lib instead of using Url Loading System.

NasaGeek
  • 2,138
  • 1
  • 15
  • 19
McGar
  • 205
  • 1
  • 10
  • Here the author designed a generic class to do the task in asynchronously. http://stackoverflow.com/questions/11728098/ios-objective-c-equivalent-of-androids-asynctask – Whoami Jul 30 '14 at 06:02

2 Answers2

1

It sounds like NSURLConnection is the equivalent, or the new NSURLSession class that was added in iOS 7.

NSURLConnection does async GET/PUT transactions. It handles managing the background networking, and then notifies you about progress on the main thread, which makes your code cleaner.

NSURLSession is a higher level API to manage whole networking tasks. I've read about it but haven't had occasion to use it yet.

Duncan C
  • 128,072
  • 22
  • 173
  • 272
0

It is a little different from Java.

Most developers have wrote her own URL Loading System Class to load asynchronous content.

This Guide from Apple will help u Loading Guide Apple

Mirko Brunner
  • 2,204
  • 2
  • 21
  • 22