Search code examples
iphoneiosios4

Application didFinishLaunchingWithOptions or applicationDidBecomeActive


I would like to know how I can provide the way to user for downloading the content from server.

If the user subscribes for one month, I want to deliver them a new content (songs) every day. But I am not sure how to work on this.

Do I need to call the webservice in application didFinishLaunchingWithOptions or in the - (void)applicationDidBecomeActive:(UIApplication *)application {

Which one should I use for this kind of situation?


Solution

  • If you're planning on starting a new connection when the app launches, then you'll want to use

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        // Override point for customization after application launch.
        return YES;
    }
    

    However, applicationDidBecomeActive is better suited for resuming a download that you paused when your application was backgrounded. Starting the download here COULD also be acceptable too.

    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }