Work around KVC Crasher in CMObject -description method #82
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
NOTE: Merge after #80
A customer reports a low but non-negligible crash rate from
CMObject's -description method. The method throws a
NSUndefinedKeyException in rare circumstances, which we can not
reproduce. The key being called is one observed dynamically by
the MAObjCRuntime library. This is the most conservative fix:
in this method only, we call a "safe" version of valueForKey: which
wraps the call in a @try-@catch block.
A more aggressive fix would have been to override -valueForUndefinedKey:
on CMObject, but given the runtime trickery used throughout the app,
I can't feel 100% confident there would be no other side effects in
doing so. There have been other places in the SDK where @try-@catch had
been used for actual control flow.
The ideal fix would be to track down why the RT lib is returning a
property name that subsequently results in an undefined key exception.
Given the low incedence and the fact its coming from a non-critical
code path, investing that time seems overkill for now.