title: How to force user to allow location-services and push notifications?
body: <p>How can we force user to allow the permissions the app requires? I wanna force the user to allow both location-services and push-notifications, but at the moment, if user click "dont allow", the user can access all functionality. </p>
  
  <p>I would like to loop the pop-up message where user must click allow. Meaning, if user click "dont allow", the popup will keep appear until user selects "allow". </p>
  
  <p>Maybe there's a library with such functionality?</p>
  
  <p>EDIT:</p>
  
  <p>my code right now:</p>
  
  <pre><code>func checkIfUserEnabledLocation(){
  
          if !hasLocationPermission() {
              let alertController = UIAlertController(title: "Location Permission Required", message: "Please enable location permissions in settings.", preferredStyle: UIAlertController.Style.alert)
  
              let okAction = UIAlertAction(title: "Settings", style: .default, handler: {(cAlertAction) in
                  //Redirect to Settings app
                  UIApplication.shared.open(URL(string:"App-Prefs:root=Privacy&amp;path=LOCATION")!)
              })
  
              let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertAction.Style.cancel)
              alertController.addAction(cancelAction)
  
              alertController.addAction(okAction)
  
              self.present(alertController, animated: true, completion: nil)
          }
      }
  
      func hasLocationPermission() -&gt; Bool {
          var hasPermission = false
          if CLLocationManager.locationServicesEnabled() {
              switch CLLocationManager.authorizationStatus() {
              case .notDetermined, .restricted, .denied:
                  hasPermission = false
              case .authorizedAlways, .authorizedWhenInUse:
                  hasPermission = true
              default:
                  print("hello")
              }
          } else {
              hasPermission = false
          }
  
          return hasPermission
      }
  </code></pre>
  
  <p>This code I fire from button-clicks etc in the app. But I want on startup, the user can't proceed to app at all if they don't allow locations!</p>