I have an adobe AIR app developed for iOS devices and I use Adobe Flash Builder 4.7 to create the .ipa file.
Up to version 23 of the AIR SDK the app was working fine. With version 24 of the AIR SDK a Permissions class was added when trying to access the device camera. And now one should programmatically handle the permissions when accessing the camera as follows: https://forums.adobe.com/thread/2250328
I have tried implementing the given example in my codebase, and in the following snippet, I have null references to the permissions as follows:
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);
}
My hunch is that when debugging on the device the Flash Builder is using the flex sdk instead of the AIR SDK which makes the aforementioned properties/methods unavailable as stated in the SDK documentation: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/media/Camera.html where one can see that the permissionStatus method is only available for the AIR runtime.
Therefore, how can I check and make sure that I am debugging using the AIR runtime and eventually avoid my app to crash when asking the user for camera permissions.