How much does AppDelegate cost?

I am developing a rather large application and it will create sessions with several different servers when launched. Since they create a session that is used in all parts of the application, this is what I thought was the best in App Delegate.

But the problem is I need the session to be presented on the screen. I plan on having a UIToolBar at the bottom of the main menu, which I don't want to cover with a progress bar, but I cover the UIView above it. The way I see it, I could do it in several different ways.

1) Have the application delegate set up sessions and report progress to the main menu class so that it can present it in the progress bar (would I have any problems if sessions are created on a separate thread?).

2), the app delegate displays the main menu (UIView with a bundle of buttons and a UIToolBar) and tracks and displays progress (I've never shown anything in the App Delegate, but I assume you can, but not recommended), or

3), the application delegate just clicks the main menu and the mainMenu class creates sessions and displays a progress bar.

4) I think another way to do it is to create sessions in the delegate class and assign the delegate to mainMenu and not myself (AppDelegate), although I have never used anything other than myself, so not sure if this will work , or if I can close the stream (via a call to super, maybe?) how to start it in the AppDelegate, not the class delegate.

As I said before sessions are created in the class on a separate thread, so it won't block the UI and I think the first way is the best way, but I will have problems starting it on a separate thread, telling the application delegate and then sending this message to the mainMenu view?

I hope this makes sense, let me know if you need any clarification. Any information is appreciated

Greetings,

+2


a source to share


1 answer


Presumably the state of the connections will affect the functionality of your application. I would probably think in terms of a connection manager object that can initiate connections, maintain its state, and respond when asked about its status. Just like a singleton object will return an existing object or create and return a new object from none, the connection manager doesn't even need a "make connection" method, just "get handle" - if the connection isn't open, you can try this.



You also indicate that the status should be indicated on the main screen. Having a manager object capable of performing tasks of an indefinite amount of time (opening a connection to a host that might be ready, busy, deleted, or just broken) in the background and then report progress to the main thread, so the UI can be updated (remember, that UIKit access on secondary threads) seems to be perfect and it preserves your look too.

+1


a source







All Articles