Try MAXST AR Fusion Tracker Now ✨
List
Requesting Permissions on iOS
Posted Date: 2021-06-22 8:03     Edited Date: 2021-07-01 17:28     Writer: jh895298

Please provide your development details as below;

1. SDK Version:5.0.3 
2. Development Environment: Unity-iOS 
3. Tracker/Scanner:Cloud Recognition 
4. License Type(Free / Pro-One Time Fee / Pro-Subscription / Enterprise):Free 
5. Target Device(Optional):
 

Hello, Maxst Team. I am currently developing a validation for camera access on iOS, looking in your SDK I found that the CameraDevice Class makes a request for permission to access the camera on Android at startup. My question is Does your SDK perform permission request for the camera on iOS ?.

Thanks.

 

Posted Date: 2021-06-25 9:20     Edited Date: 2021-06-25 9:20     Writer: sjkim

Thank you for your interest in MAXST.

 

We don't exactly understand your question.

 

Do you need a camera permission like Unity-android? Or

Do you need a camera permission function for ios in the start() function of your script?

 

If you have related the MAXST SDK questions, feel free to ask.

 


 
Best regards,

Francisco

MAXST Support Team

Posted Date: 2021-06-25 20:16     Edited Date: 2021-06-25 20:16     Writer: jh895298

Hello Maxst Team 

I need to disable camera permission on iOS and enable it in some function of my script.

Thank you.

 

Posted Date: 2021-07-01 2:25     Edited Date: 2021-07-01 2:25     Writer: sjkim

Sorry to late reply.

 

Camera permission in iOS requests camera activation through (int)requestCameraPermission(), a native function inside xcode.

So, to implement your own function in Unity, please refer to the (int)requestCameraPermission() function below.

 

(int)requestCameraPermission {


  AVAuthorizationStatus status = [AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo];  

 if(status == AVAuthorizationStatusNotDetermined) {
    dispatch_semaphore_t semaphore = dispatch_semaphore_create(0);


    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
      dispatch_semaphore_signal(semaphore);
    }];
    dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER);    return [self requestCameraPermission];
  }


  else if(status == AVAuthorizationStatusDenied) {
    return CameraPermissionIsNotGranted;
  }


  else if(status == AVAuthorizationStatusRestricted) {
    return CameraDevicedRestriced;


  }  return Success;
}

 

 

Best regards,

Francisco

MAXST Support Team

Posted Date: 2021-07-01 17:28     Edited Date: 2021-07-01 17:28     Writer: jh895298

Thank you very much Maxst Team