iOS 使用 Adob​​e AIR SDK 24 构建的应用程序在尝试使用权限时崩溃

iOS app build with Adobe AIR SDK 24 crashes when trying to use permissions

我有一个为 iOS 设备开发的 adobe AIR 应用程序,我使用 Adob​​e Flash Builder 4.7 创建 .ipa 文件。

在 AIR SDK 版本 23 之前,该应用程序运行良好。在 AIR SDK 版本 24 中,尝试访问设备相机时添加了权限 class。现在应该在访问相机时以编程方式处理权限,如下所示:https://forums.adobe.com/thread/2250328

我尝试在我的代码库中实现给定的示例,在下面的代码片段中,我对权限的引用为空:

   private function connect():void {      
        if (Camera.permissionStatus/*permissionStatus is null*/ != PermissionStatus.GRANTED)
        {       
                  cam.addEventListener(PermissionEvent.PERMISSION_STATUS,
                    function(e:PermissionEvent):void {
                        if (e.status == PermissionStatus.GRANTED) {
                            connectCamera();
                        } else {
                            // permission denied
                        }
                    });

                try {
                    cam.requestPermission(); // **when calling this one my app crashes**
                } catch(e:Error) {
                    // another request is in progress
                }
         } else {
              connectCamera();
         }
    }

    private function connectCamera():void
    {
        video = new Video(640, 480);
        video.attachCamera(cam);
        addChild(video);
    }

我的直觉是,在设备上调试时,Flash Builder 使用的是 flex sdk 而不是 AIR SDK,这使得上述 properties/methods 不可用,如 SDK 文档中所述:http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html 其中可以看到 permissionStatus 方法仅适用于 AIR 运行时。

因此,我如何检查并确保我正在使用 AIR 运行时进行调试,并最终避免我的应用程序在询问用户相机权限时崩溃。

也许是这个? https://forums.adobe.com/thread/2264992

Kindly include cocoa keys under tag in app.xml For Example, If you are trying to access the Camera in your application, you need to include below tag under NSCameraUsageDescription "SOME TEXT"
Please refer to below link for detailed information on cocoa keys: Cocoa Keys