0

I have an app using GPUImage that provides a preview + camera functionality. When user has camera disabled, app works fine - proper functionality, IE no crash. When user launches app with camera enabled, app works fine as well. The problem arises when user has camera disables, goes to Settings and enables camera. I didn't see anything special in the stack trace and obviously it's from the toggling of the camera.

I do this in viewDidLoad to check for camera authorization

if(status == AVAuthorizationStatusAuthorized) {
    [self.stillCamera startCameraCapture];
}
else if(status == AVAuthorizationStatusDenied){ // denied
    //push modal to say change settings in settings
}
else if(status == AVAuthorizationStatusRestricted){ // restricted
    //push modal to say change settings in settings

}
else if(status == AVAuthorizationStatusNotDetermined){ // not determined

    [AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL granted) {
        if(granted){  [self.stillCamera startCameraCapture];

        } else {

        }
    }];
}

[self.stillCamera startCameraCapture] is a GPUImage method call.

The GPUImage documentation states that the framework uses OpenGL so there is the issue of throttling down/stopping camera capture when app resigns active. Could it be an issue with the OpenGL backing GPUImage, and if so, how to solve.

Is there a generalized way to solve this or could this be a framework specific issue?

I saw this from 2012, does this answer still apply in 2016 running iOS 9? - SO answer regarding permissions change causing crashes

Community
  • 1
  • 1
noobsmcgoobs
  • 2,716
  • 5
  • 32
  • 52
  • Yes, that info still applies. – rmaddy Apr 11 '16 at 03:18
  • @rmaddy Any way to keep question alive for 2016 iOS 9 since answer was from 2012? Edited to reflect that. Could be useful for current SO users. – noobsmcgoobs Apr 11 '16 at 03:24
  • It is still alive. Your question will still be here for years to come and people that come across it will see the duplicate and know it still applies. – rmaddy Apr 11 '16 at 03:28
  • Cool, I didn't have a preference either way, but it saves someone else from having to ask again. Thanks. – noobsmcgoobs Apr 11 '16 at 03:34

0 Answers0