Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[iOS] Fixes state restoration not work #31511

Merged
merged 2 commits into from
Mar 18, 2022

Conversation

zhongwuzw
Copy link
Member

Actually, the coder of decodeRestorableStateWithCoder in FlutterViewController seems is not support to use encode/decodeDataObject, it would throw exception. So we changed to bytes encoded.

Exception occurred restoring state value for key '$0' was of unexpected class 'NSMutableData' (0x1db4082a8) [/System/Library/Frameworks/CoreFoundation.framework].
Allowed classes are:
 {(
)}

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Sorry, something went wrong.

@chinmaygarde
Copy link
Member

chinmaygarde commented Mar 10, 2022

Can you describe or link the issue please?

@chinmaygarde
Copy link
Member

The patch does look fine to me. I am just not sure what issue it is cross referenced to.

@zhongwuzw
Copy link
Member Author

The patch does look fine to me. I am just not sure what issue it is cross referenced to.

@chinmaygarde We added the feature of state restoration on iOS, but when we enable it and restore the state, it crashes and throws the exception like below. State restoration decoder seems can't use the decodeDataObject method, so we need to change to bytes encoded.

Exception occurred restoring state value for key '$0' was of unexpected class 'NSMutableData' (0x1db4082a8) [/System/Library/Frameworks/CoreFoundation.framework].
Allowed classes are:
 {(
)}

@zhongwuzw zhongwuzw force-pushed the fix_state_restore_decode branch from ba517d6 to b9e29d5 Compare March 18, 2022 02:26
@zhongwuzw zhongwuzw added the waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. label Mar 18, 2022
@godofredoc godofredoc added the warning: land on red to fix tree breakage Override tree-status signal (land even with closed tree), combine with the autosubmit label. label Mar 18, 2022
@fluttergithubbot fluttergithubbot merged commit 5e37879 into flutter:main Mar 18, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
platform-ios waiting for tree to go green This PR is approved and tested, but waiting for the tree to be green to land. warning: land on red to fix tree breakage Override tree-status signal (land even with closed tree), combine with the autosubmit label.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants