-
Notifications
You must be signed in to change notification settings - Fork 90
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
Route object encode and decode #555
Comments
Please replace the
JSONDecoder is the way to convert JSON to a Route. There’s also a convenience initializer that takes each individual piece of data in structured form. |
@1ec5 I printed out some details...
3306228 I have 4 different Route objects and looks like it fails for all of them... |
This means the JSON object you tried to decode is missing a
#382 rewrote the library in pure Swift, enabling us to take advantage of the Swift standard library’s Codable protocol instead of maintaining custom JSON parsing code that was rife with implicitly unwrapped optionals.
Java doesn’t have an analogue to Codable, so the considerations above don’t apply. I’m unaware of any plans to change JSON facilities in mapbox-java. If that ever happens, you’ll see it take place in that repository, and I’m sure there will be a suitable replacement, because the navigation SDK depends on the ability to round-trip JSON for various tasks. |
I want to save the object Route object to server, and recreate the Route object with the data from server in a future session.
I'm encoding the data as follows:
I saw the following example from documentation to decode:
https://docs.mapbox.com/ios/navigation/examples/route-deserialization/
Route object is nil after this...
Also another thing to mention in Firestore I can see the data type as Blob
Versions:
pod 'Mapbox-iOS-SDK', '6.3.0'
pod 'MapboxDirections', '1.2.0'
pod 'MapboxNavigation', '1.4.1'
Xcode: 12.5.1
The text was updated successfully, but these errors were encountered: