KVO crashes in older OS-Versions not replicable in Sequoia

Greetings,

With MacOS 15 Sequoia, Apple updated key-value-observations in such a way, that an unremoved observation by a now deallocated object will no longer cause an exception, when the observed object triggers said observation.

While this is fundamentally a positive change, the issue comes with the fact, that this change affects systems based on the version of their operating system and not the version of the operating system of the build system.

Many of our customers use old operating system versions and old hardware - meaning they can't easily update. Since we need to use up to date Xcode versions to develop for newer systems, our developers tend to have rather new OS versions.

This means, that we are increasingly facing bugs which only happen in customer systems but not in most developer (or QA) systems.

Currently, we still can use earlier OS versions with Xcode to fix these bugs, but once the used Xcode versions no longer support MacOS 14 or below this will become a major hurdle.

Are there known solutions to this issue?

We are currently attempting to swizzle observer adding and removal in order to fix the problem for old systems as well, but this has proven to be quite difficult and unstable. Since any weakly held property in the middle of an observation keypath can cause crashes, one would have to split up observations into multiple subobservations, which is less simple than it sounds, due to custom implementations of addObserver (such as there seems to be in array controller proxies) and collection operators.

Thanks for any suggestions!

Answered by DTS Engineer in 857073022

back soon

Small correction to my post: It is actually the array controllers themselves which seem to have the custom implementation, not the proxies. For an arrayController a you may observe a.arrangedObjects.y, but observing y on a.arrangedObjects will be rejected due y not being a valid key path for an array controller proxy.

back soon

KVO crashes in older OS-Versions not replicable in Sequoia
 
 
Q