Jay
Jay

Reputation: 163

How to show two different app usage message for NSCameraUsageDescription

In my application, the camera used in two places so how can I show two different messages for "NSCameraUsageDescription".

I've created the strings file to add messages for multiple languages but the message for camera access should not be same.

I couldn't find any document related to showing different messages for camera access on different places.

Upvotes: 4

Views: 1466

Answers (2)

alobaili
alobaili

Reputation: 904

Unfortunately what you are describing is not possible directly. NSCameraUsageDescription is a static string included in the Info.plist file and it's documented to require only one string (localized to multiple languages).

Apple's guideline in cases where more than one description is needed for different contexts is to use a custom pre-alert screen.

As @mehul-thakkar already pointed, try to generalize the string for NSCameraUsageDescription, but before displaying the system alert, show a custom screen or view that provides more context with one button that displays the system alert. You might want to make sure that this custom pre-alert screen is only displayed if permission is being requested for the first time.

Upvotes: 0

Mehul Thakkar
Mehul Thakkar

Reputation: 12594

App usage message is going to shown only once, when you first time use your app. It is not going to be used everytime you use the app. In App, you can use it any number of times at any number of places. You cant show different message for all different places. You have to create single generic message which is just used to take permission from user that we/our app is going to access your private photos as well as your camera. So, message must be to take permission from user.

Upvotes: 0

Related Questions