Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

IDMah

macrumors 6502
Original poster
May 13, 2011
317
11
Hi all.

This is more of a theory or best practices, question.

I have a Highscore sender getter web service. Which I was planning on staring on the Hight Score view. BUT ! I'd like, if the sender / getter fails, for it to keep working till it updates.. (even after I release calling the view) and while the main game is playing. is the term persist?

How do I do this without too much book keeping?
or would it create a zombie child task if I closed the calling view?

I'm using AFNetworking.
Sorry if this is basic or my understanding all is wrong..
Networking, and multitasking hurts my little brain !!

thanks
Ian
 
Hi all.

This is more of a theory or best practices, question.

I have a Highscore sender getter web service. Which I was planning on staring on the Hight Score view. BUT ! I'd like, if the sender / getter fails, for it to keep working till it updates.. (even after I release calling the view) and while the main game is playing. is the term persist?

How do I do this without too much book keeping?
or would it create a zombie child task if I closed the calling view?

I'm using AFNetworking.
Sorry if this is basic or my understanding all is wrong..
Networking, and multitasking hurts my little brain !!

thanks
Ian

So your talking about sending or receiving data over the network?

Cocoa Touch makes that easy. There is a class, NSURLConnection, that lets you submit requests that are processed in the background, and when they are done, you get notified on the main thread.

The easiest way to do it would probably be to create a Utilities singleton and have it manage the connection.

A new method was added to NSURLConnection in iOS 5, sendAsynchronousRequest:queue:completionHandler: You can use that to start a GET or POST, and provide a block of code that gets invoked once the get/post is complete. It's easier to use than the old method of setting up a delegate to the NSURLConnection and handling a number of delegate methods.
 
thanks.. Works now I just need to figure out how to trigger the update of the views..

Will Create a new thread because it's more about me not understanding how to call methods of subviews.

thanks
Ian
 
thanks.. Works now I just need to figure out how to trigger the update of the views..

Will Create a new thread because it's more about me not understanding how to call methods of subviews.

thanks
Ian

A new forum thread, or change your programming to work on a new thread?

I would strongly advise AGAINST creating new threads to do downloading in the background. Threads are expensive to set up, and tie up physical memory on the device for the lifetime of the thread.

Apples async upload/download system is designed to provide support for background uploading/downloading WITHOUT creating threads, and Apple STRONGLY encourages you to use it.
 
"Question thread" ie. Post .. Sorry for the confusion.
But Copy that NewThread bad.. will not use.. or try not to..

thanks
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.