tags:

views:

1313

answers:

3

Hi All,

I am having a Default.png file in my project, so that whenever my app launches Default.png file loads there. As my app is retrieving data from server at startup(app launch), i want to show activity indicator as well while Default.png file is loading. Is it possible to activate both the process at a time, i mean showing Default.png and enable activity indicator at a time during startup? But i tried putting Activity Indicator code in 'applicationDidFinishLaunching' but it doesn't show activity indicator at the time of showing Default.png file. But i am sure that Activity code what i have, is working fine on other screens. Problem is only during app launch.

Can someone share your ideas please?

thanks.

Clave/

+3  A: 

You can't do any animation in the Default.png image. You should replace it as soon as possible with a view/controller (containing the activity indicator). Than after showing that controller, load your data and possibly an other controller (in a thread).

Jongsma
Thanks a lot for All. I resolved.
Clave Martin
A: 

What i do in my app is immediately load an imageview with the Default.png image covering the screen. then you can add a progress indicator on top of the imageview while you do your server work on a background thread.

You should always avoid net activity in the applicationDidLaunch method as this method has a timeout after which, if it does not return, Apple will kill your app. this is important because say the user is on edge and the server trip takes 30 seconds - your app will appear to have crashed to the user.

By doing the net work in a background thread and returning applicationDidLaunch, you will keep apple from killing your app, you will be able to let the user use the app before the new data comes in (if you want) and your app will appear to launch faster.

coneybeare
A: 

You should always avoid net activity in the applicationDidLaunch method as this method has a timeout after which, if it does not return, Apple will kill your app. this is important because say the user is on edge and the server trip takes 30 seconds - your app will appear to have crashed to the user.

So you think that I should not put XMLPraser on the applicationDidLaunch?

NSURL *url = [[NSURL alloc] initWithString:@"http://sites.google.com/site/iphonesdktutorials/xml/Books.xml"]; NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:url];

//Initialize the delegate.
XMLParser *parser = [[XMLParser alloc] initXMLParser];

//Set delegate
[xmlParser setDelegate:parser];

//Start parsing the XML file.
BOOL success = [xmlParser parse];

if(success)
 NSLog(@"No Errors");
else
 NSLog(@"Error Error Error!!!");
edgard rodriguez