Open chamberlain2007 opened 9 years ago
I can confirm the issue. I have seen it regurarly in production but never able to figure out the root cause.
Workaround to fix it: https://github.com/mrcmd/LARSAdController/commit/dcd39374b5f055d8e07c23b787c9afd26b9faabe
@chamberlain2007 The latest version is 3.0.7 -- please try that and see if this alleviates the issue. I know we've done some work specifically with the KVO stuff, as well as added a delegation pattern to use rather than relying on KVO -- which is much less error-prone and won't result in crashes when something goes wrong.
@mrcmd We should try and find the root cause of over-removing the observer rather than just catching it. Try using the latest version and see if this helps.
@larsacus This crash is around kLARSAdObserverKeyPathIsAdVisible, which has no change in the adding/removal of the KVO around it. That is to say, I agree with the delegation pattern, but it probably won't solve this crash. I haven't been able to get a proper test case, so trying the new version won't verify much. For what it's worth, it happens most frequently on iPhone 4S running 7.1.2 (according to Crashlytics).
@mrcmd I'm hesitant to do this. If there is an observer that is being removed to many times, it's probably also being removed too early. I worry that there is a period in which something thinks that it should be getting notified of visibility changes and is not. The crash itself is worrisome, sure, but I wouldn't be surprised if there were other side-effects that simply catching the error wouldn't solve.
I'm seeing a fairly frequent crash in production, caused by removing an observer from an ad adapter which it is not observing, along the lines of the following:
Full stacktrace is as follows:
I haven't been able to reproduce the crash with any consistency (I've seen it a few times), but have seen it a few times. However, it outweighs the other crashes in Crashlytics by a wide margin.
We are currently using version 3.0.2 installed via CocoaPods. I see there has been some work around the KVO with kLARSAdObserverKeyPathAdLoaded, but this seems to be the opposite issue with kLARSAdObserverKeyPathIsAdVisible: instead of registering too many times for notifications, it seems to happen to few.
Any thoughts on this?