M Reza
M Reza

Reputation: 19708

Display two different text for one permission

I need to display two different messages for Privacy - Camera Usage Description permission based on the view controller user reaches first. But I can only add one text in info.plist file.

For example if user first goes to viewController1, I need to show a text for permission and if user goes to viewController2, I need to show a different text. Is that possible?

Upvotes: 2

Views: 1060

Answers (1)

Paulw11
Paulw11

Reputation: 114865

The permission text is set in info.plist, so you cannot change it at runtime.

The permission dialog is only shown the first time that you request access to the camera, so it doesn't really make sense to have action specific permission requests; once permission is either granted or denied there are no further prompts shown to the user.

Your permission text should describe why you need access to the camera, perhaps mentioning both uses. Something like

MyGroovyApp needs access to the camera to create awesome selfies and to scan barcodes

Before requesting permission you could display an alert that explains why you are going to request permission. You can use whatever text you like in this alert.

Upvotes: 3

Related Questions