Advice needed regarding networking

Discussion in 'iOS Programming' started by Soulstorm, Sep 8, 2011.

  1. Soulstorm macrumors 68000

    Soulstorm

    Joined:
    Feb 1, 2005
    #1
    We are developing an application that involves heavy networking. The way the application is set up now is:

    At startup, the application is connecting to a server (we created the server, so it can be heavily customized). While it is doing that, it displays a Logo. So, in order for the application to enter the main screen, it must download all data needed from the server. So it makes 2 requests. Note that information exchange between the server and the client is achieved using an XMPP stream (underlying BSD sockets).

    And there lies the problem. Sometimes, that request is taking TOO long. Although the client sends the necessary request data, the server is "stuck". When that happens, it's as if the application cannot enter into the main screen.

    The question is: What do we do in this occasion, apart from optimizing our server? I'm looking for some general guidance.
     
  2. forum user macrumors regular

    Joined:
    Aug 28, 2008
    #2
    Move the call to your "serverCommunicationMethod" from appDidFinishLaunching to viewDidLoad or viewWillAppear in your first viewcontroller.

    The app startup must happen with in (IIRC) 20 seconds. App startup is finished sometime around the moment when the first VC is loaded. Thus your app wont timeout on startup. Plus, if you detect a timeout from the server you can handle it appropriately.

    If (in addition) you put the server communication into a background thread is another thing.

    - Olaf
     

Share This Page