1
1
111010102015-10-31 11:34:39
API
11101010, 2015-10-31 11:34:39

What to use instead of singleton server manager?

Why is it bad practice to make a server-manager singleton? How to do it right and why?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2015-10-31
@11101010

First time I hear about this. Another thing is how to write it and for what purposes it is, what are the restrictions. It is necessary to answer such questions:
From my experience, I came to the conclusion that it is best to use a queue (if you plan to implement for iOS less than 7, then use NSOperationQueue + NSOperation, if 7+ then NSURLSession + NSURLSessionDownloadTask) And, depending on the answer, set the maximum number of executable downloads.
this question is relevant if you implement NSURLSessionDownloadTask on iOS 7+ - can be designed to be loaded into background.
From my experience, I found a more or less universal solution, after the request has received a response, it is immediately processed inside the manager and used by NSNotificationCenter to notify all the necessary controllers.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question