Hi everyone.
When iOS 14 beta 5 was released we started getting a crash on our app, the classic "Cannot remove an observer <XYZBinding 0x600000d6b750> for the key path "state" from <XYZEntryChat 0x7f960a77a900> because it is not registered as an observer.".
However, nothing had changed in our code base to justify that, indeed the code that was crashing hadn't been changed in several months. The crash persists even in the official iOS 14 release.
We investigated and, by chance, found that the observationInfo object in XYZEntryChat, that should hold the information about the registered observers, is being deallocated after being created, without any intervention from our part.
Also by chance, we found that overriding either the - (void)setObservationInfo:(void *)observationInfo method or the observationInfo getter in the XYZEntryChat class the issue no longer occurs.
In many other classes that use the same base code to handle bindings the issue does not occur.
We have no further leads on why this is happening, it may be an iOS 14 bug or some behaviour change on iOS 14 that uncovered a wrong usage flow in our app. We also investigated if it was related to Objective-C / Swift interoperability, but other classes that also use / are used by Swift don't have the issue.
Has anyone ever came across this behaviour or has any idea of what the root cause may be?
Thanks in advance.
When iOS 14 beta 5 was released we started getting a crash on our app, the classic "Cannot remove an observer <XYZBinding 0x600000d6b750> for the key path "state" from <XYZEntryChat 0x7f960a77a900> because it is not registered as an observer.".
However, nothing had changed in our code base to justify that, indeed the code that was crashing hadn't been changed in several months. The crash persists even in the official iOS 14 release.
We investigated and, by chance, found that the observationInfo object in XYZEntryChat, that should hold the information about the registered observers, is being deallocated after being created, without any intervention from our part.
Also by chance, we found that overriding either the - (void)setObservationInfo:(void *)observationInfo method or the observationInfo getter in the XYZEntryChat class the issue no longer occurs.
In many other classes that use the same base code to handle bindings the issue does not occur.
We have no further leads on why this is happening, it may be an iOS 14 bug or some behaviour change on iOS 14 that uncovered a wrong usage flow in our app. We also investigated if it was related to Objective-C / Swift interoperability, but other classes that also use / are used by Swift don't have the issue.
Has anyone ever came across this behaviour or has any idea of what the root cause may be?
Thanks in advance.