What NSNumber (Integer 16, 32, 64) in Core Data should I use to keep NSUInteger

前端 未结 2 1181
长情又很酷
长情又很酷 2020-12-14 05:23

I want to keep NSUInteger into my core data and I don\'t know which type should I use (integer 16, 32, 64) to suit the space needed.

From my understanding:



        
2条回答
  •  失恋的感觉
    2020-12-14 06:08

    Do you really need the entire range of an NSUInteger? On iOS that's an unsigned 32 bit value, which can get very large. It will find into a signed 64 bit.

    But you probably don't need that much precision anyway. The maximum for a uint32_t is UINT32_MAX which is 4,294,967,295 (4 billion). If you increment once a second, it'll take you more than 136 years to reach that value. Your user's iPhone won't be around by then... :)

提交回复
热议问题