title: Detect when requestAlwaysAuthorization not called iOS 14
body: <p>I am trying to request user's location using multi step process; However, when calling <code>requestAlwaysAuthorization</code> if it is not executed I would like to move to show a message.</p>
  <p>let me explain better by showing my flow</p>
  <p>Here is my current flow</p>
  <ol>
  <li>Request <code>While in use</code>
  <ul>
  <li>The user chooses <code>Allow Once</code> -&gt; Go to <code>2</code></li>
  <li>the user chooses <code>Allow While Using App</code> -&gt; Go to <code>2</code></li>
  <li>the user chooses <code>Don't Allow</code> -&gt; show error message</li>
  </ul>
  </li>
  <li>Request <code>Always permission</code>
  <ul>
  <li>The user chooses <code>Keep Only While Using</code> -&gt; Show error message (issue #1: I can't detect this)</li>
  <li>The user chooses <code>Change to Always Allow</code> -&gt; Show success message</li>
  </ul>
  </li>
  </ol>
  <p>If from <code>1</code> the user chose <code>Allow Once</code> I can't even call <code>requestAlwaysAuthorization</code> because calling it would result in nothing and even Apple states</p>
  <blockquote>
  <p>If the user responded to requestWhenInUseAuthorization() with Allow Once, then Core Location ignores further calls to requestAlwaysAuthorization() due to the temporary authorization.</p>
  </blockquote>
  <p><a href="https://developer.apple.com/documentation/corelocation/cllocationmanager/1620551-requestalwaysauthorization" rel="nofollow noreferrer">Source</a></p>
  <p>My goal is if users selects <code>Allow Once</code> from <code>1</code> then <code>requestAlwaysAuthorization</code> should be skipped all together.</p>
  <p>if from <code>1</code> <code>Allow Wile Using App</code> is selected and from <code>requestAlwaysAuthorization</code> <code>Keep Only while using</code> is chosen then I would like to know that state.</p>
  <p>I know it can be done, I just don't know how. Here is an app that does what I am trying to achieve</p>
  <p><a href="https://i.stack.imgur.com/PREYxm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PREYxm.png" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/CWq5Gm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CWq5Gm.png" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/rdLykm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rdLykm.png" alt="enter image description here" /></a></p>
  <p>From the first image user chose <code>Allow While Using App</code> then <code>Keep Only While Using</code> and they are able to detect it or able to detect the fact that the dialogue appeared and they didn't move to the third image until the user responded.</p>
  <p>Another scenario as follows:</p>
  <p><a href="https://i.stack.imgur.com/GTsfGm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GTsfGm.png" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/NhooGm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NhooGm.png" alt="enter image description here" /></a> <a href="https://i.stack.imgur.com/KjG41m.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KjG41m.png" alt="enter image description here" /></a></p>
  <p>From the first image the user chose <code>Allow Once</code> and from the 2nd image no matter what the user choose they will go to image 3 without displaying the always permission (keep in mind the 2nd image is not a real permission, its just buttons that made to trick the user); so they are able to tell the dialogue didn't appear or that the user chose <code>Allow Once</code> from the previous step (one or the other and I can't do either one).</p>
  <p>Obviously I cant record every combination and post as a gif, so if you would like to experiement the app name is <code>Zenly</code></p>
  <p><strong>So the end goal is to be able to wait for the user to respond to the dialogue if it appears otherwise just move to the next screen.</strong></p>
  <p>Here is what I have done, quoting from apple</p>
  <blockquote>
  <p>Core Location leaves the authorization as When In Use. The delegate doesn’t receive any updates.</p>
  </blockquote>
  <p>I thought maybe when requesting always I should also execute the delegate manually so to the function <code>requestAlwaysLocation()</code> I added the line</p>
  <pre><code>self.locationManagerDidChangeAuthorization(self.locationManager)
  </code></pre>
  <p>However, that obviously doesn't work because in the case that <code>Allow While Using App</code> was chosen from step <code>1</code> and <code>Change to Always Allow</code> is chosen from step <code>2</code> now the delegate will be called twice...</p>
  <p>Then I thought if I can detect the provisioning <code>When in Use</code> from step <code>1</code> I might be able to bypass but I don't know how to do it.</p>
  <p>Here is a snippet of <code>LocationManager</code></p>
  <pre><code>    func requestWhenInUserLocation()  {
          self.locationManager.requestWhenInUseAuthorization()
      }
      
      func requestAlwaysLocation() {
          self.locationManager.requestAlwaysAuthorization()
      }
  
  
      func locationManagerDidChangeAuthorization(_ manager: CLLocationManager) {
          print(&quot;authroizatino changed&quot;)
  //        let accuracyAuthorization = manager.accuracyAuthorization
          let status = manager.authorizationStatus
  
          // -change function will just change some internal properties and will post a notification so views that subscribe to it can react accordingly.
          
          switch status {
              case CLAuthorizationStatus.authorizedAlways:
                  self.change(permission: .Location, to: .Location(.Always))
                  break
              case CLAuthorizationStatus.authorizedWhenInUse:
                  self.change(permission: .Location, to: .Location(.WhenInUse))
                  break
              case CLAuthorizationStatus.denied:
                  self.change(permission: .Location, to: .Denied)
                  break
              case CLAuthorizationStatus.notDetermined:
                  self.change(permission: .Location, to: .NotDetermined)
                  break
              case CLAuthorizationStatus.restricted:
                  self.change(permission: .Location, to: .Location(.Restricted))
                  break
              @unknown default:
                  self.change(permission: .Location, to: .Unknown)
                  break
          }
      }
  
  
  </code></pre>
  <p>I hope I was able to explain what I want clearly</p>