fix: Type hinting MPIdentityApiRequest.identities #270
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.
Summary
Fix crash when accessing the
-[MPIdentityApiRequest identity]
property from Swift due to incorrect type hintingWe had it hinted as
<NSNumber*, NSString*>
but then we also storedNSNull
objects in some cases. That was fine with Objective-C since it ignores the type hints at runtime, but Swift doesn't and crashes if any NSNull objects are present when accessing theidentities
property.Note this doesn't actually change the underlying behavior of this property in any way, it just now is correctly type hinted as
<NSNumber*, NSObject*>
to include the possibility ofNSNull
.Testing Plan
Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)