简体   繁体   中英

How to On/Off Location Services for TestFlight Apps?

I have developed an iPhone app which uses location services. i uploaded it to TestFlight and downloaded it to iPhone device to check.

The app asks for location permission after login. If the permission is granted, it will work fine. If "Denied", it will display a message asking to turn on the location services.

I "denied" the permission, closed the application and restarted it, but seems iPhone can remember the previous location settings. It did not ask me again whether I need to allow location services.This happened in Simulator as well, so I think this is how iOS is.

Since my app is in TestFlight, how can I turn on/off location service for this, so now I can check how it will work with location services on?

As you rightly say, this is just how iOS works. Once the user has denied location services to an app, that app does not have the ability to summon the system permissions dialog again.

If your app would like to put up its own alert on startup or when it needs to use location services and discovers that location services is off or that its status is denied , fine. But that would be entirely up to your app. Basically you are begging the user to head over to Settings and authorize your app; you can even include a button in your alert that switches to Settings for the user, and that's a pretty common thing to do.

Okay, so what about testing your app? Well, if you just want to know whether your app works when location services authorization is granted, just go to Settings and grant them, as the user might do.

If you want to start all over with no authorization status ( notDetermined ), so that you can see if your app summons the system dialog correctly, you need to delete the app entirely from your device and reinstall it. If that isn't sufficient, you will have to reset permissions entirely (in Settings, under General > Reset > Reset Location & Privacy); this is kind of a pain, because it resets all permissions, but sometimes it's the only way to get the device to clear its cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM