Setting NSCameraUsageDescription programmatically?












0















I have a requirement to display a different camera permissions message, one for when the user starts the QR scanner, and one for taking a photo.



The user can start with either one, and product don't want to use a generic message for both.



Is there a way to set NSCameraUsageDescription programmatically, or can this only be done within Info.plist?



Thanks










share|improve this question





























    0















    I have a requirement to display a different camera permissions message, one for when the user starts the QR scanner, and one for taking a photo.



    The user can start with either one, and product don't want to use a generic message for both.



    Is there a way to set NSCameraUsageDescription programmatically, or can this only be done within Info.plist?



    Thanks










    share|improve this question



























      0












      0








      0








      I have a requirement to display a different camera permissions message, one for when the user starts the QR scanner, and one for taking a photo.



      The user can start with either one, and product don't want to use a generic message for both.



      Is there a way to set NSCameraUsageDescription programmatically, or can this only be done within Info.plist?



      Thanks










      share|improve this question
















      I have a requirement to display a different camera permissions message, one for when the user starts the QR scanner, and one for taking a photo.



      The user can start with either one, and product don't want to use a generic message for both.



      Is there a way to set NSCameraUsageDescription programmatically, or can this only be done within Info.plist?



      Thanks







      ios swift






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 22 '18 at 9:18









      wvteijlingen

      8,23112544




      8,23112544










      asked Nov 22 '18 at 9:06









      thedpthedp

      3,530144278




      3,530144278
























          3 Answers
          3






          active

          oldest

          votes


















          2














          You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.



          You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.






          share|improve this answer

































            1














            As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.



            Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.






            share|improve this answer
























            • I doubt if apple approves this :(

              – Aakash
              Nov 22 '18 at 9:44











            • Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

              – Lorenzo Zanotto
              Nov 22 '18 at 10:02











            • @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

              – thedp
              Nov 22 '18 at 10:06













            • I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

              – Aakash
              Nov 22 '18 at 10:11











            • @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

              – Lorenzo Zanotto
              Nov 22 '18 at 10:17



















            1














            Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.






            share|improve this answer























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427266%2fsetting-nscamerausagedescription-programmatically%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              2














              You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.



              You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.






              share|improve this answer






























                2














                You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.



                You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.






                share|improve this answer




























                  2












                  2








                  2







                  You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.



                  You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.






                  share|improve this answer















                  You can't edit the Info.plist of your app. You don't have write access to that file. In fact an app's bundle is read-only. You can't save changes to your bundle.



                  You should use a generic message mentioning both cases in the permission message. This way user knows that this permission will also be utilised in other places too.







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 22 '18 at 9:14









                  thedp

                  3,530144278




                  3,530144278










                  answered Nov 22 '18 at 9:10









                  AakashAakash

                  1,343715




                  1,343715

























                      1














                      As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.



                      Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.






                      share|improve this answer
























                      • I doubt if apple approves this :(

                        – Aakash
                        Nov 22 '18 at 9:44











                      • Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:02











                      • @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                        – thedp
                        Nov 22 '18 at 10:06













                      • I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                        – Aakash
                        Nov 22 '18 at 10:11











                      • @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:17
















                      1














                      As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.



                      Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.






                      share|improve this answer
























                      • I doubt if apple approves this :(

                        – Aakash
                        Nov 22 '18 at 9:44











                      • Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:02











                      • @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                        – thedp
                        Nov 22 '18 at 10:06













                      • I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                        – Aakash
                        Nov 22 '18 at 10:11











                      • @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:17














                      1












                      1








                      1







                      As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.



                      Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.






                      share|improve this answer













                      As pointed out, .plist files cannot be edited at runtime. Anyways they can be localized. It's possible to create multiple Localizable.strings files containing different values for your NSCameraUsageDescription.



                      Right after, you could change the localization file your app is pointing to, obtaining the correct text that will be displayed in the alert.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Nov 22 '18 at 9:35









                      Lorenzo ZanottoLorenzo Zanotto

                      1365




                      1365













                      • I doubt if apple approves this :(

                        – Aakash
                        Nov 22 '18 at 9:44











                      • Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:02











                      • @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                        – thedp
                        Nov 22 '18 at 10:06













                      • I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                        – Aakash
                        Nov 22 '18 at 10:11











                      • @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:17



















                      • I doubt if apple approves this :(

                        – Aakash
                        Nov 22 '18 at 9:44











                      • Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:02











                      • @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                        – thedp
                        Nov 22 '18 at 10:06













                      • I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                        – Aakash
                        Nov 22 '18 at 10:11











                      • @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                        – Lorenzo Zanotto
                        Nov 22 '18 at 10:17

















                      I doubt if apple approves this :(

                      – Aakash
                      Nov 22 '18 at 9:44





                      I doubt if apple approves this :(

                      – Aakash
                      Nov 22 '18 at 9:44













                      Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                      – Lorenzo Zanotto
                      Nov 22 '18 at 10:02





                      Replacing localization strings at runtime is something that lots of applications do and there's nothing in the Developer Agreements that state such thing. That would be a totally viable approach :)

                      – Lorenzo Zanotto
                      Nov 22 '18 at 10:02













                      @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                      – thedp
                      Nov 22 '18 at 10:06







                      @LorenzoZanotto can you explain how to replace a localized InfoPlist.string my app is pointing to? thanks

                      – thedp
                      Nov 22 '18 at 10:06















                      I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                      – Aakash
                      Nov 22 '18 at 10:11





                      I am concerned about apple and may be some users too might find out by doing this we are hiding out what our apps will exactly do with a permission. BTW I am also curious too know if this is feasible just for knowledge :)

                      – Aakash
                      Nov 22 '18 at 10:11













                      @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                      – Lorenzo Zanotto
                      Nov 22 '18 at 10:17





                      @thedp you can take a look here, it explains how to change the bundle you're reading from stackoverflow.com/questions/49649199/…

                      – Lorenzo Zanotto
                      Nov 22 '18 at 10:17











                      1














                      Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.






                      share|improve this answer




























                        1














                        Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.






                        share|improve this answer


























                          1












                          1








                          1







                          Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.






                          share|improve this answer













                          Besides the general message, you may present your customized alert message before request authorization somewhere, even with cooling animations.







                          share|improve this answer












                          share|improve this answer



                          share|improve this answer










                          answered Nov 22 '18 at 13:11









                          E.ComsE.Coms

                          2,1222414




                          2,1222414






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53427266%2fsetting-nscamerausagedescription-programmatically%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              Ottavio Pratesi

                              Tricia Helfer

                              15 giugno