Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Location Permission behavior #124

Open
vadimue opened this issue Mar 23, 2018 · 1 comment
Open

Wrong Location Permission behavior #124

vadimue opened this issue Mar 23, 2018 · 1 comment

Comments

@vadimue
Copy link

vadimue commented Mar 23, 2018

I am developing an app, which uses location always. So I request Location permission with status "Always" on viewDidLoad() of WelcomeViewController. Steps of this flow:

  1. App show alert with three buttons "Only when using the app", "Always Allow", "Don't Allow".
  2. User chooses "Only when using the app".
  3. User reopen app and did not see any notification
  4. User reopens app again (and all next times) and sees the denied notification.

The problem is user don't see notification second time. I read a source code and find out the line of cause such behavior: On second time UserDefaults.standard.requestedLocationAlwaysWithWhenInUse still false, so we have wrong status of location permission that's why app requests permission again instead of showing denied alert. And in this second requesting UserDefaults.standard.requestedLocationAlwaysWithWhenInUse became true, so on third time we have correct status.

Frankly, I don't know how to fix this problem by the clean way, can you have any suggestion?

@vadimue
Copy link
Author

vadimue commented Mar 23, 2018

@sunshinejr Hi, I guess maybe you can know about this flow? Why we need return UserDefaults.standard.requestedLocationAlwaysWithWhenInUse ? .denied : .notDetermined in case of authorizedWhenInUse status, and don't return simply .denied? I think it can resolve my problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant