Reputation: 143
I am using Camera in my application. I check for camera permission and if the camera permission is not enabled I show a dialog asking the user to go to settings.
If the user accepts I redirect to Settings page. Here 2 cases occur -
1) If the user accepts the dialog and goes to settings page but does not enable camera permission but clicks Back(with App Name, not the Back on Settings Navigation Bar) the view controller which redirected to Settings is shown.
2) If the user enables the camera permission and clicks back, the Home View Controller of the app is shown.
I want to show the view controller which redirected to Settings in both the cases.
I have the below code in my View Controller but still this function is not called in the 2nd case.
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];
I am using Objective-C
Upvotes: 0
Views: 86
Reputation: 1814
When user changes the app Settings
, the OS automatically kills the app. That's why your app launches when you click back in 2) but not 1)
To simulate restoration after coming back,
1) Add a UserDefaults
value with the name of the active UIViewController
before leaving
2) On appDidFinishedLaunching
redirect to it.
Upvotes: 3