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

Fix toString conversion on iOS 12 #1584

Merged
merged 2 commits into from
Sep 20, 2022
Merged

Fix toString conversion on iOS 12 #1584

merged 2 commits into from
Sep 20, 2022

Conversation

evil159
Copy link
Contributor

@evil159 evil159 commented Sep 20, 2022

JSONEncoder doesn't support encoding top-level fragments on iOS 12(bug report). This PR makes toString() to use JSONSerialization(which supports top-level fragments) on iOS 12 instead.

Pull request checklist:

  • Describe the changes in this PR, especially public API changes.
  • Write tests for all new functionality. If tests were not written, please explain why.
    Not testable

PRs must be submitted under the terms of our Contributor License Agreement CLA.

@evil159 evil159 requested a review from a team as a code owner September 20, 2022 05:57
if #available(iOS 13.0, *) {
data = try JSONEncoder().encode(self)
} else {
// JSONEncoder doesn't support fragments on older iOS versions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add a link from the PR description here? It was very helpful to understand why it doesn't work.

@evil159 evil159 enabled auto-merge (squash) September 20, 2022 07:18
@evil159 evil159 merged commit 1c72bb2 into main Sep 20, 2022
@evil159 evil159 deleted the rl/to-string-conversion-fix branch September 20, 2022 07:27
persidskiy pushed a commit that referenced this pull request Feb 24, 2023
* Fix for Style/updateLayer fail if nested properties dictionary contains nil (#1565)

- Error happens due to layer's properties contains nil values for nested keys, for these keys, default values will not be applied so they would appear as nil when updating a layer. The fix is to only apply nil encoding for the root properties of the dictionary.

* Flag MapRecorder with @_spi(Internal) (#1582)

* Remove unused images when updating point annotations (#1583)

* Parse GeoJSON data on a background queue (#1576)

* Fix toString conversion on iOS 12 (#1584)

* Use asynchronous GeoJSON marshaling in annotation managers (#1588)

* update generated docs (#1586)

* Fix GeoJSONData.url incorrectly converting to string (#1587)

* Expose distance-from-center and pitch expressions  (#1559)

* Bump MapboxCoreMaps and MapboxCommon (#1589)

* Expose opacity for location puck (#1585)

* Fix merge issues

Co-authored-by: Mai Mai <mai.mai@mapbox.com>
Co-authored-by: Roman Laitarenko <roman.laitarenko@mapbox.com>
Co-authored-by: Ankur Khandelwal <ankur.khandelwal@mapbox.com>
Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>
Co-authored-by: ZiZi <44972592+ZiZasaurus@users.noreply.github.com>
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.

None yet

3 participants