Can you auto-terminate a suspended application?

Discussion in 'iOS Programming' started by AdamA9, Nov 25, 2010.

  1. AdamA9 macrumors 6502a

    Joined:
    Feb 2, 2010
    #1
    Guys,

    Just a quick question - can you set an application to automatically terminate after a period of time that it is suspended?

    Thanks
     
  2. AdamA9 thread starter macrumors 6502a

    Joined:
    Feb 2, 2010
    #3
    Thanks. Do you know if it's possible to make entering a passcode mandatory, one that is held on the device? I know o2 have one on their, but I don't think the code is stored on the device, more seems server end?

    Also, if my application is suspended. Upon re-entering, can I do either of the following:

    1. Force the user to re-enter their passcode
    2. Force the user back to the login screen to re-authenticate their login credentials
    3. Re-authenticate the login credentials before allowing the user to take control of the application

    I'm working on something that holds personal data, so security is a concern for me. The user is required to login to the applciation to aquire personal data, and set a passcode. If the user leaves the application it cannot auto-terminate (based on above), so I need another way to make sure the data is secure should someone else gain access to the device.

    Thanks
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
    #4
    Your application delegate object is informed when the app restarts from suspend: you can do whatever you want at that point.
     
  4. Luke Redpath macrumors 6502a

    Joined:
    Nov 9, 2007
    Location:
    Colchester, UK
    #5
    You can, and indeed should, do all of those things if security is paramount with your app. Apple make specific recommendations about this. The 1Password app does it, for example.

    As Robbie says, your App Delegate will receive callbacks when your app resumes - you can do whatever you need to at this point to re-secure your app.

    Another thing to consider is the display of sensitive information when the app is sent to the background. The OS will take a snapshot of the screen to be used as a launch image when the app resumes; this makes the transition more seamless, but Apple recommends that you hide any sensitive information before the app is suspended (again, you can be notified of this from either the app delegate callback or by subscribing to the appropriate NSNotification), to ensure that this sensitive information is not stored in this image on disk.

    Finally, whilst you cannot have the app exit after a specific amount of time, you *can* opt out of background/resume operation by adding the appropriate Info.plist key but you should only consider this as a last resort.
     

Share This Page