"currentDevice.torchAvailable" crash
tettoffensive opened this issue · comments
Fatal Exception: NSInternalInconsistencyException
Cannot update for observer <PBJVision 0x15c75cfb0> for the key path "currentDevice.torchAvailable" from <PBJVision 0x15c75cfb0>, most likely because the value for the key "currentDevice" has changed without an appropriate KVO notification being sent. Check the KVO-compliance of the PBJVision class.
Fatal Exception: NSInternalInconsistencyException
0 CoreFoundation 0x182da6e38 __exceptionPreprocess
1 libobjc.A.dylib 0x18240bf80 objc_exception_throw
2 CoreFoundation 0x182da6d80 -[NSException initWithCoder:]
3 Foundation 0x1836c79f8 -[NSKeyValueNestedProperty object:withObservance:didChangeValueForKeyOrKeys:recurse:forwardingValues:]
4 Foundation 0x1836a3a24 NSKeyValueDidChange
5 Foundation 0x18368e6b4 -[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:]
6 PBJVision 0x1011e3160 __29-[PBJVision _sessionStarted:]_block_invoke (PBJVision.m:2351)
This seems to be our apps most common crashes in the app store recorded by crashlytics. Though I've not seen it happen on my personal device
The only place I can find where _currentDevice
is being changed without will/DidChangeValueForKey
is in _destroyCamera
. So I'm guessing this could be it. I'm using setCurrentDevice
in other places but this should automatically call it. And anywhere else I see the ivar changing, the will/Did are there.
Going to try changing it to this:
[self willChangeValueForKey:@"currentDevice"];
_currentDevice = nil;
[self didChangeValueForKey:@"currentDevice"];