I'm parsing json object with Id (long) coming from a Java backend. the id is declared as CLong in my app. On iPhones5 < it works, but on iPhone5 the id is invalid value.
CLong
is a typedef
for Int
in the iOS SDK:
/// The C 'long' type.
public typealias CLong = Int
From the Swift docs :
- On a 32-bit platform, Int is the same size as Int32.
- On a 64-bit platform, Int is the same size as Int64.
Unless you need to work with a specific size of integer, always use Int for integer values in your code. This aids code consistency and interoperability. Even on 32-bit platforms, Int can store any value between -2,147,483,648 and 2,147,483,647, and is large enough for many integer ranges.
If you need to keep your Integer size consistent across multiple architectures, use Int32
. If you value is larger than 32 bits, you should look into handling overflows . Also consider sending a different data type rather than a long from your backend, such as a String
or NSNumber
.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.