We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I have troubles with parsing simple values, like Float,
i wrote simple test:
{ "floatArray": [9.123, 0.000001, 0.1, -2] }
func testParseFloatArray() { guard let path = Bundle(for: type(of: self)).path(forResource: "FloatArray", ofType: "json"), let data = try? Data(contentsOf: URL(fileURLWithPath: path)), let json = try? JSONParser.JSONObjectWithData(data) else { XCTFail("Error parsing FloatArray.json") return } do { let array: [Float] = try json.value(for: "floatArray") XCTAssert(array.count == 5) XCTAssert(array[0] == 9.123) } catch { XCTFail(String(describing: error)) } }
and it fails with:
▿ Type mismatch. Expected type Float for key: floatArray. Got '__NSCFNumber' ▿ typeMismatchWithKey : 3 elements - key : "floatArray" - expected : Swift.Float - actual : __NSCFNumber
Should i try to make pull request with fix for this?
The text was updated successfully, but these errors were encountered:
@jarsen ? Anyone?
Sorry, something went wrong.
Looks like this is a swift 4/xcode 9 issue.
I encounter it also, I don't know Apple will fix it before iOS11 formal release. It should be NSDecimalNumber, not NSNumber.
I updated Xcode today to 9.3 with swift 4.1 and this issue happens again. Please help
No branches or pull requests
Hi,
I have troubles with parsing simple values, like Float,
i wrote simple test:
and it fails with:
Should i try to make pull request with fix for this?
The text was updated successfully, but these errors were encountered: