Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Fix warning about decoding a boolean #1436

Merged
merged 1 commit into from
Jun 12, 2024
Merged

[Bug] Fix warning about decoding a boolean #1436

merged 1 commit into from
Jun 12, 2024

Conversation

nan-li
Copy link
Contributor

@nan-li nan-li commented May 15, 2024

Description

One Line Summary

Fixes a warning about decoding an object as a boolean by using the decode boolean method.

Details

Use decodeBool instead of decodeObject as Bool, for the flag indicating if a live activities request is successful.

This was added in #1377, and we didn't catch the warnings.

Motivation

Xcode warning about future errors.

*** -[NSKeyedUnarchiver decodeObjectForKey:]: value for key (requestSuccessful) is not an object. 
This will become an error in the future.

*** -[NSKeyedUnarchiver decodeObjectForKey:]: value for key (requestSuccessful) is not an object. 
This will become an error in the future.

Scope

Decoding a boolean from cache, which defaults to false if not there, which is unlikely to happen as there are guards ensuring other properties are successfully decoded.

Testing

Manual testing

Encountered this purple warning message in the Xcode log, then went away.
Screenshot 2024-05-15 at 2 29 39 PM

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

@nan-li nan-li changed the title [Bug] warning about decoding a boolean [Bug] Fix warning about decoding a boolean May 15, 2024
@nan-li nan-li requested review from emawby and jennantilla May 29, 2024 01:04
* Use decodeBool instead of decodeObject as Bool
@nan-li nan-li merged commit d2b7803 into main Jun 12, 2024
4 checks passed
@nan-li nan-li deleted the fix/decode_bool branch June 12, 2024 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants