UIBackgroundTaskIdentifier question

Discussion in 'iOS Programming' started by erdinc27, Feb 16, 2016.

  1. erdinc27 macrumors regular

    Joined:
    Jul 20, 2011
    #1
    Is it possible to run the application still when the user taps to home button two times and remove the application from background ?
     
  2. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #2
    When the app is killed by the user from the task bar that's it. It's killed. There may be some cases where the app is restarted by the system but in the normal case the app stays killed.
     
  3. erdinc27 thread starter macrumors regular

    Joined:
    Jul 20, 2011
    #3
    so how about the situation there the user didnt Kill the application just took it background by using home button. As i know the OS will terminate it after a certain time. If so is it possible to restart it by device with the user settings that were set before application was killed ?
     
  4. PhoneyDeveloper macrumors 68030

    PhoneyDeveloper

    Joined:
    Sep 2, 2008
    #4
    If an app goes to the background it isn't necessarily killed. It's only killed if the system decides to do this. The usual explanation would be due to memory pressure, but the OS can do what it likes. If your app has started a background task it will continue to run until the timeout. Then it will be backgrounded but not killed. An app may stay in the background for weeks without being killed.

    If you want your app to restart in the same state it was in when it went to the background, regardless of whether the app was simply backgrounded or was killed, then it is up to your app's code to do this. Apple provides some capability to do this but usually you have to do something specific for your app to make this work.
     
  5. erdinc27 thread starter macrumors regular

    Joined:
    Jul 20, 2011
    #5
    Thank u for useful information. I saved some informations to NSUserDefaults then read it back from there when the app is active again.
     

Share This Page