Skip to main content
Participant
January 17, 2017
Answered

Unable to set iOS camera permissions with AIR SDK 24

  • January 17, 2017
  • 3 replies
  • 6865 views

As the air sdk 24 was released, it introduced the permissions API. Currently I have an app that targets the iOS platform and when it tries to access the camera, it fails with Error #3800: This call requires Camera permission.

I have tried to follow the example provided in the SDK release notes (12/13/2016 - Release - AIR 24 Runtime and SDK but when calling cam.requestPermission(); as outlined in the example, the app is crashing silently and the debugger doesn't show any error.

I am using Adobe Flash Builder 4.7 with AirSDK 24 installed and the target device is an iPad AIR with iOS 10.1.

One note though is that I have tried debugging the following properties/method calls:

Camera.permissionStatus

cam.requestPermission();

and in my console result both undefined, even though in Flash Builder it clearly shows that I am using AIR SDK 24 and also the xml app descriptor also is using version 24, is it possible that the IDE in debug mode is using another SDK version?

My fear is that the Flex SDK 4.6 that I am using in the IDE is replacing the AIR SDK and that is why the new methods/properties are not available, I have tried overlaying the Flex SDK with the AIR SDK but the IDE is complaining about that and it seems I cannot overlay Flex SDK 4.6 with AIR SDK 24.

Any thoughts on how can I be sure that I am debugging my app using the AIR SDK 24 with the Flash Builder 4.7 and also request camera permissions from the user?



This topic has been closed for replies.
Correct answer deesharm

Hi Xqstilo,

Kindly include cocoa keys under <infoAdditions> tag in app.xml

For Example, If you are trying to access the Camera in your application, you need to include below tag under <infoAdditions>

<key>NSCameraUsageDescription</key>

<string>"SOME TEXT"</string>

Please refer to below link for detailed information on cocoa keys:

Cocoa Keys

Thanks,

Adobe AIR Team

3 replies

Participating Frequently
March 11, 2018

I have the same problem in Adobe Animate building IOS app in test mode. SKD 28.0.0.125

While updating an older application. Camera permissions dialog does not pop up. Additionally in settings on the iPhone under my app, there are no options to enable Camera Use. What could be the problem? I added the NSCameraUsageDescription and others to the xml file, please see below.

I attempted severa times, I deleted the app and recompiled it and installed via USB. Allow camera pop-up does not show. Checking the code in the debugger I get: PermissionError: 'Error #3800: This call requires CameraUI permission. in this line cCameraUI.launch(MediaType.IMAGE); after passes camera support test.

Applications XML below:

<?xml version="1.0" encoding="utf-8" standalone="yes"?>

<application xmlns="http://ns.adobe.com/air/application/28.0">

    <id>com.AppXYZ.service</id>

    <versionNumber>1.5.4</versionNumber>

    <filename>AppXYZ It</filename>

    <description></description>

    <!-- To localize the description, use the following format for the description element.

  <description>

  <text xml:lang="en">English App description goes here</text>

  <text xml:lang="fr">French App description goes here</text>

  <text xml:lang="ja">Japanese App description goes here</text>

  </description>

  -->

    <name>AppXYZ It</name>

    <!-- To localize the name, use the following format for the name element.

  <name>

  <text xml:lang="en">English App name goes here</text>

  <text xml:lang="fr">French App name goes here</text>

  <text xml:lang="ja">Japanese App name goes here</text>

  </name>

  -->

    <copyright></copyright>

    <initialWindow>

        <content>AppXYZRealCustomerAppIOS002.swf</content>

        <systemChrome>standard</systemChrome>

        <transparent>false</transparent>

        <visible>true</visible>

        <fullScreen>true</fullScreen>

        <autoOrients>false</autoOrients>

        <aspectRatio>portrait</aspectRatio>

        <renderMode>auto</renderMode>

    </initialWindow>

    <customUpdateUI>false</customUpdateUI>

    <allowBrowserInvocation>false</allowBrowserInvocation>

    <icon>

        <image29x29>IOS%20ICONS/AppXYZ%20Logo-29x29.png</image29x29>

        <image57x57>IOS%20ICONS/AppXYZ%20Logo-57x57.png</image57x57>

        <image114x114>IOS%20ICONS/AppXYZ%20Logo-114x114.png</image114x114>

        <image512x512>IOS%20ICONS/AppXYZ%20Logo-512x512.png</image512x512>

        <image48x48>IOS%20ICONS/AppXYZ%20Logo-48x48.png</image48x48>

        <image72x72>IOS%20ICONS/AppXYZ%20Logo-72x72.png</image72x72>

        <image50x50>IOS%20ICONS/AppXYZ%20Logo-50x50.png</image50x50>

        <image58x58>IOS%20ICONS/AppXYZ%20Logo-58x58.png</image58x58>

        <image100x100>IOS%20ICONS/AppXYZ%20Logo-100x100.png</image100x100>

        <image144x144>IOS%20ICONS/AppXYZ%20Logo-144x144.png</image144x144>

        <image1024x1024>IOS%20ICONS/AppXYZ%20Logo-1024x1024.png</image1024x1024>

        <image40x40>IOS%20ICONS/AppXYZ%20Logo-40x40.png</image40x40>

        <image76x76>IOS%20ICONS/AppXYZ%20Logo-76x76.png</image76x76>

        <image80x80>IOS%20ICONS/AppXYZ%20Logo-80x80.png</image80x80>

        <image120x120>IOS%20ICONS/AppXYZ%20Logo-120x120.png</image120x120>

        <image75x75>IOS%20ICONS/AppXYZ%20Logo-75x75.png</image75x75>

        <image60x60>IOS%20ICONS/AppXYZ%20Logo-60x60.png</image60x60>

        <image87x87>IOS%20ICONS/AppXYZ%20Logo-87x87.png</image87x87>

        <image167x167>IOS%20ICONS/AppXYZ%20Logo-167x167.png</image167x167>

        <image152x152>152.png</image152x152>

        <image180x180>180.png</image180x180>

    </icon>

    <iPhone>

        <requestedDisplayResolution>high</requestedDisplayResolution>

        <InfoAdditions><![CDATA[

  <key>NSCameraUsageDescription</key>

        <string>Take and upload a picture of the items to transport.</string>

  <key>NSPhotoLibraryUsageDescription</key>

        <string>Upload a picture of the items to transport from the photo library.</string>

  <key>NSPhotoLibraryAddUsageDescription</key>

        <string>Write a picture of the items to transport from the photo library.</string>

  <key>UIDeviceFamily</key>

     <array><string>1</string><string>2</string></array>

]]></InfoAdditions>

    </iPhone>

</application>

Participating Frequently
March 11, 2018

Just a thought it could be related to NSPhotoLibraryAddUsageDescription.

If I open the plist in Xcode I don't see the private in front of it. Notice in the image it does not say Privacy -

garda86
Participating Frequently
December 18, 2017

Hello,

I've added the mentioned tags in my app.xml

The app works correctly, that is the user is prompted a message requesting to allow the use of the camera. And then it works.

Neverthless my last attempt to publish the app (using Air 27) in ITunes was rejected by Apple Team with the following motivation:

Guideline 5.1.1 - Legal - Privacy - Data Collection and Storage

We noticed that your app requests the user’s consent to access the camera but does not clarify the use of this feature in the permission modal alert.

They also attached a screenshot taken from my app. Here it is:

So, it seems that even if I specified the NSCameraUsageDescription tag, the message is not shown in the popup.

This cause my app to be rejected by Apple team.

Here is how my app.xml looks like

<?xml version="1.0" encoding="UTF-8" standalone="no" ?>

<application xmlns="http://ns.adobe.com/air/application/20.0">

  ...

  <initialWindow>

    ...

  </initialWindow>

  <icon>

    ...

  </icon>

  <iPhone>

    <requestedDisplayResolution>high</requestedDisplayResolution>

    <InfoAdditions>

        <key>NSCameraUsageDescription</key>

        <string>Take photos to players, coach and team, in order to produce more engaging reports</string>

<![CDATA[

... other stuff ...

]]>

    </InfoAdditions>

  </iPhone>

  <extensions>

    ...

  </extensions>

</application>

What is the problem?

Thank you in advance

kheftel
Inspiring
December 18, 2017

why are you using AIR namespace 20.0? Shouldn't it be 27.0 for AIR SDK 27? Also, the camera roll/camera permissions were added in AIR 24, IIRC

garda86
Participating Frequently
December 18, 2017

mmmhh... you are right!

I forgot to update that reference.

Ok I'll try to publish again the app in ITunes after modifing the xmlns.

I'll inform you about the result.

Thank you!

deesharm
Adobe Employee
deesharmCorrect answer
Adobe Employee
January 18, 2017

Hi Xqstilo,

Kindly include cocoa keys under <infoAdditions> tag in app.xml

For Example, If you are trying to access the Camera in your application, you need to include below tag under <infoAdditions>

<key>NSCameraUsageDescription</key>

<string>"SOME TEXT"</string>

Please refer to below link for detailed information on cocoa keys:

Cocoa Keys

Thanks,

Adobe AIR Team

xqstiloAuthor
Participant
January 18, 2017

Hello Deesharm,

Thanks very much for the hints, in my xml config I was adding the key under the Entitlements tag, how is the infoAdditions different from that, and btw it works now