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