odd
odd

Reputation: 385

Why does all permissions need to be asked before app is shown in settings?

My application is tracking a user and allowing them to create annotations/markers with information/images stored in them. This is my info.plist permission usages.

<key>NSAppleMusicUsageDescription</key>
<string>info</string>
<key>NSCameraUsageDescription</key>
<string>info</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>info</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>info</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>info</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>info</string>
<key>UIBackgroundModes</key>
<array>
    <string>audio</string>
    <string>location</string>
</array>

The user is directly asked for location permission WhenInUseUsage to show their position on the map. Then when user wants to start tracking their position i ask for AlwaysUsage permission and prompt them to the apps settings screen. At this stage it will not find the apps settings screen.

I have tried to reinstall my application, restarting phone, other phones etc. Only when i also ask for camera permission will app show up in settings screen. I would only want to ask for photo permission when the user is actually going to use it for context of why i am asking.

This is how i ask for permissions inside settings:

func showSettingsAlert(){
    let alert = UIAlertController(title: C.Alert.settingsTitle, message: C.Alert.settingsMessage, preferredStyle: .alert)
    alert.addAction(UIAlertAction(title: C.Alert.setting, style: .default, handler: { action in
        
        UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:], completionHandler: nil)
    }))
    alert.addAction(UIAlertAction(title: C.Alert.cancel, style: .default, handler: nil))
    self.present(alert, animated: true, completion: nil)
}

Is this intended? Should all permission need to be asked at start of runtime before i can send user to apps settings screen? What have i missed?

Upvotes: 0

Views: 1018

Answers (1)

Robin Schmidt
Robin Schmidt

Reputation: 1203

If you want to direct the user to the settings panel before asking for any permission, you could add a Settings.bundle to your project. This will make sure, that the settings panel is available directly after installation.


Edit:
Sorry, I didn't get what you're trying to do in first place..

Each permissions will only appear in the settings after you requested it in your app.
You should ask the user for each permission in a context, where the user tries to use a feature, where this permission is required. The user should be able to understand, why you are requesting this permission.
So it isn't a good approach to ask all your permissions at start of your app.

For example:
Ask for location, when the user opens a map and wants to see his position.
Ask for camera permission, when the user taps the "scan QRCode" button or "take photo" button. Etc..

Upvotes: 1

Related Questions