0

We developed a photo editor app using phonegap and vanilla javascript and built using phonegap build. This app typically uses cordova-plugin-camera to capture still photos and PICK photos from the camera roll. In the testing environment, we use real devices for both platforms, Android and iOS. This works perfectly in Android, however in iOS11, the plugin does NOT ask for the First-Use permission upon using the picture picker, users can access their camera roll directly. We haven't noticed this thing during the testing phase, the app review team have raised this issue to our attention that the app is not requesting user permission before accessing sensitive information.

This code does not ask for first-use permission on iOS11 when app is built on phonegap build (xcode9)

navigator.camera.getPicture(onSuccess, onFail, {
  destinationType: Camera.DestinationType.FILE_URI,
  sourceType: Camera.PictureSourceType.PHOTOLIBRARY
  });

There is no issue with using Camera.PictureSourceType.CAMERA as the plugin is capable of handling the permission issue properly. It is worth mentioning that we have implemented all the permission descriptions required for iOS10+ in the *-Info.plist and as well as during plugin installation. Even more, we have noticed that the app doesn't crash on iOS11.4 if those descriptions were omitted from the configuration files.

<engine name="ios" spec="latest" />
<preference name="phonegap-version" value="cli-8.0.0" />
<preference name="target-device" value="handset" />
<preference name="TARGETED_DEVICE_FAMILY" value="1" />
<preference name="IPHONEOS_DEPLOYMENT_TARGET" value="10.0" />

We tested this on iphone 7, iphone 8, and iphone X with the latest iOS11.4 update, all of which reproduced the same results, no permission asked.

We tested the plugin cordova-imagePicker from Telerik Team and it works well with first-use permission, however we noticed that they didn't implement a fallback if the user rejected the request, the app will crash.

So, anyone have noticed this recently? Any clues how to deal with this? Is this caused by phonegap build?

Thanks for your time.

Robin
  • 143
  • 3
  • 7

1 Answers1

0

good day. I had a similar problem with the camera of the plugin with Cordova when I started using it. I was able to use XCode and compiled them and was able to find what is missing. The Permission, bellow is the code provided by XCode.

 <plugin name="cordova-plugin-camera" spec="^4.0.2">
   <variable name="CAMERA_USAGE_DESCRIPTION" value="Use Camera" />
   <variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value="Select Photo" />
 </plugin>

The above code will ask the user for permission of the app to use the camera also the gallery if you need it.

I hope this helps you.

gentlyawesome
  • 172
  • 1
  • 4
  • 16
  • Thanks for your answer, we'll give it a try and feed you back, but do you mean that it's not working on phonegap build? and it will work if XCode is used instead? because I'm using a similar approach to your code with Phonegap Build but with no luck. – Robin Jul 05 '18 at 09:48
  • Yes. XCode can help cause there you can set your permissions. I have used Cordova in this project. This link can help you greatly, if you have XCode: https://stackoverflow.com/questions/38498275/ios-10-changes-in-asking-permissions-of-camera-microphone-and-photo-library-c – gentlyawesome Jul 05 '18 at 10:02
  • Even after adding this code, when testing an IPA on my device no permissions are ever asked? And if I go to settings, the only available option to grant access to is mobile data – JohnGIS Oct 02 '19 at 06:53
  • Please follow these steps: https://stackoverflow.com/a/38498347/3898735 – gentlyawesome Oct 03 '19 at 07:49