You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It seems that on iOS 10, for some big numbers that fit in an Int64, JSONSerialization creates not a normal NSNumber but an instance of NSDecimalNumber.
On iOS 11, a big number like the one above becomes an NSNumber so everything works fine.
Environment
iOS 10
Swift 4.0
Additional Detail from JIRA
md5: 7519541942cc0ceab4b15571af866560
Issue Description:
The "
Parsed JSON number <1000000000000000070> does not fit in Int64.
" error occurs when running the following code on iOS 10.It seems that on iOS 10, for some big numbers that fit in an
Int64
,JSONSerialization
creates not a normalNSNumber
but an instance ofNSDecimalNumber
.On iOS 11, a big number like the one above becomes an
NSNumber
so everything works fine.iOS 10 probably can't be fixed but it seems to me that changing the code at https://github.com/apple/swift/blob/a62647f0685c3c832756d9f635cfe527d45037de/stdlib/public/SDK/Foundation/JSONEncoder.swift#L2100-L2103 to the code below would fix the problem.
The text was updated successfully, but these errors were encountered: