On previous version of Delphi this line of code is working....

On previous version of Delphi this line of code is working....

Status := TAVCaptureDevice.OCClass.authorizationStatusForMediaType(AVMediaTypeVideo);

but under Tokyo this method "authorizationStatusForMediaType" does not exists anymore....

How do I test if the app is authorize to use the camera app in iOS.

Comments

  1. That method has not been in the Delphi source since Berlin, so probably even before that. You'll need to do something like this:

    uses
    iOSapi.AVFoundation, iOSapi.Foundation, iOSapi.CocoaTypes;

    type
    AVAuthorizationStatus = NSInteger;

    TRequestAccessForMediaTypeCompletionHandler = procedure(success: Boolean) of object;

    AVCaptureDeviceClass = interface(iOSapi.AVFoundation.AVCaptureDeviceClass)
    ['{9B4047B4-2565-46E8-A4F3-325300B1968D}']
    { class } function authorizationStatusForMediaType(mediaType: NSString): AVAuthorizationStatus; cdecl;
    { class } procedure requestAccessForMediaType(mediaType: NSString; completionHandler: TRequestAccessForMediaTypeCompletionHandler); cdecl;
    end;
    TAVCaptureDevice = class(TOCGenericImport) end;

    ReplyDelete

Post a Comment