Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

programmatically localize info.plist on iOS

I am facing a problem with a specific translation issue on iOS. The app I am currently working on gets all the texts it displays from a web service. I have been able to implement this everywhere with one single exception:

I have not yet found a way to programmatically alter texts from info.plist which get used from the system in code I cannot control. The one I need to deal with is "Privacy - Camera Usage Description". So far any documentation I have found tells me to add localized text versions for info.plist - but in this particular case this won't help me, because different customers may specify different texts for the same language, and I sometimes do not even know what language the texts are in, so I cannot solely rely on static data in the app to select the proper text version.

Is there any way to set such a text programmatically, or if that isn't possible to catch the alert displaying it and replace it with one of my own?

like image 835
ChristophO Avatar asked Nov 07 '22 09:11

ChristophO


1 Answers

No, It's not possible, we can not change Info.plist runtime. But if I was there in place of you I will do one thing as a solution. Display a custom alertview with your specified text from the api. Which will ask that "We will use your camera". If user says "Ok" than display the system's alertview for the permission with static localized string. It needs 2 time interaction but it can guide user thoroughly.

like image 54
Nikunj Damani Avatar answered Nov 15 '22 13:11

Nikunj Damani