iosios8user-permissionsios-camera

How can I prevent iOS apps from resetting after changing Camera permissions?


Currently, when I change the camera permissions for my app in Settings, then navigate back to my app, the app will force a refresh and I will lose my place in the app. I follow these steps exactly:

  1. Open an app that uses the camera permission.
  2. Navigate to some screen within the app (so you can visibly see the refresh later)
  3. Go to the Settings app, navigate to the app's settings, and toggle the camera permission
  4. Double click home and go back to the app. After a few seconds, it will refresh, bringing you back to the first screen

Note: I'm using an iPhone 6 running iOS 8.4

I've noticed this behavior on all apps that have the camera permission. My question is: Is there some way to prevent the app from refreshing/restarting (on resume) after changing the camera permission? It doesn't seem to happen when you toggle location services, for example, and from a usability perspective this is horrible.

User scenario: If a user navigates deep into your app, then needs to change the camera permission (because say they accidentally clicked no last time), they will be forced to navigate back to that screen when they return. This is especially harmful for an app trying to sell you something, or sign you up for a new account. They might try to introduce a new feature where you can use the camera to take a profile picture or scan your credit card. Because the user didn't know about this feature, they might have previously denied camera access, but now want to enable it. After trying to reenable, they come back to your app to find they have to spend 5+ minutes signing up / making a purchase, again! After that, even I would probably give up.


Solution

  • I'm sure that there is no other ways to prevent restarting app. Actually you will get a SIGKILL message but no Crash log when toggling settings. See below links-

    The only way to prevent this scenario is to save the previous state of you application while terminating.

    For example- @SignUpViewController register for UIApplicationWillTerminateNotification which will fire when the app is about to terminate. Store user information there.

    - (void)viewDidLoad
    {
     [super viewDidLoad];
     [[NSNotificationCenter defaultCenter] addObserver:self
        selector:@selector(applicationWillTerminate:)
        name: UIApplicationWillTerminateNotification object:nil];
    }
    
    - (void)applicationWillTerminate:(NSNotification *)notification
    {
     // store your data here
    }
    

    Hope this will help you:)