Error when opening app with fw 1.9.3
TimTheBeastNL opened this issue ยท 10 comments
typeMismatch (Swift.Int,
Swift.DecodingError.Context(codingPath:
[CodingKeys(string Value: "data", intValue: nil), CodingKeys (string Value: "bikeDetails", intValue:
nil), -
_JSONKey(stringValue: "Index O", intValue: 0),
CodingKeys (stringValue:
"highestAvailableSpeedLimit", intValue: nil)], debugDescription: "Expected to decode Int but found a string/data instead.", underlyingError: nil))
Hi @TimTheBeastNL,
Thanks for you bug report.
Can you share some more information about your VanMoof account for example do you have a VanMoof S3/X3 registered or a VanMoof S5?
The VanMoof.Bike
model data is currently exclusively designed/compatible for a VanMoof S3/X3 so this error can be caused due to a different model structure if a VanMoof S5 is returned in the response of the VanMoof API.
Also, it would be very helpful if you could share your JSON response which you are getting from the VanMoof API as it seems like that some model data properties have changed ๐ค
$ git clone https://github.com/SvenTiigi/VanMoofKit
$ cd VanMoofKit
$ swift run vanmoof export --username "{USERNAME}" --password "{PASSWORD}" --outputDirectory "~/Downloads"
of course you should remove any kind of sensitive data from the JSON response such as your email and encryption keys of your bike!
i've run the command but then i get this error: The export failed: keyNotFound(CodingKeys(stringValue: "token", intValue: nil), Swift.DecodingError.Context(codingPath: [], debugDescription: "No value associated with key CodingKeys(stringValue: "token", intValue: nil) ("token").", underlyingError: nil))
Okay, that's kind of weird, because this failure would indicate that the login response has a different JSON format than expected ๐ค and as the CLI is using the exact same code as the example application would normally also result in a login failure when trying to login using the example application.
Just to be sure you are running the command like with this example credentials:
$ swift run vanmoof export --username "knight.rider@vanmoof.com" --password "********" --outputDirectory "~/Downloads"
Also you can check out the develop
branch where the highestAvailableSpeedLimit
property has been removed due to eliminate the decoding error (dc7480c)
got it thanks, what are some important things to remove from the file before i upload it?
Great glad to hear ๐
Please remove anything in the JSON file that is user sensitive such as your email address, phone number and most importantly any property in the JSON response named key
as this property contains a JSON object that is the encryption key for your bike.
i've checked the example.xcodeproj with the highestAvailableSpeedLimit property has been removed and the app works as intended. thanks. this will be my first real xcode project where i'm trying to make a app. so thanks for providing this.
Perfect ๐
Do you mind to share the highestAvailableSpeedLimit
property in the JSON response of your export?
This would make it possible to see what the underlying data type is that is returned by the VanMoof API.
Thanks!
And again a very weird behavior of the VanMoof API because your original reported error was:
Expected to decode Int but found a string/data instead
This was because the highestAvailableSpeedLimit
property was declared as an optional integer Int?
and the VanMoof API returned a JSON object string/data
but now it seems like the API is returning null
which should not result in a decoding error because the highestAvailableSpeedLimit
was declared an optional ๐
Thanks for your help I've just released a new version 0.0.4
โ๏ธ