How to release camera?
Opened this issue · 2 comments
If you open a new window and instantiate the camera, take a picture and then close that window, when opening again always throws an error like this
line = 2;
[ERROR] : message = "<_UIBackdropViewSettingsDark : 0x16dc5ac0>\n averageHue: 0.00\n averageSaturation: 0.00\n averageBrightness: 0.00\n contrast: 0.00\n grayscaleTintLevel: 0.11\n grayscaleTintAlpha: 0.73\n colorTint: (null)\n colorTintAlpha: 1.00\n: An -observeValueForKeyPath:ofObject:change:context: message was received but not handled.\nKey path: adjustingExposure\nObserved object: <AVCaptureFigVideoDevice: 0x16def0b0 [Back Camera][com.apple.avfoundation.avcapturedevice.built-in_video:0]>\nChange: {\n kind = 1;\n new = 0;\n}\nContext: 0x0";
[ERROR] : sourceId = 47308256;
Btw, I was able to fix the issue.
breaks when the context is nil, comment this from BeK0sukeTicameraView.m and recompile.
I can provide a binary file is anyone needs it. Cheers.
/*
[captureDevice addObserver:self
forKeyPath:@"adjustingExposure"
options:NSKeyValueObservingOptionNew
context:nil];
*/
Or, put this code in dealloc section.
AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
[device removeObserver:self forKeyPath:@"adjustingExposure"];