Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/96.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在32位iPhone上处理64位整数_Ios_Objective C_Arm_Nsuinteger - Fatal编程技术网

Ios 在32位iPhone上处理64位整数

Ios 在32位iPhone上处理64位整数,ios,objective-c,arm,nsuinteger,Ios,Objective C,Arm,Nsuinteger,我想在iPhone4S(当然有32位ARM6处理器)上处理64位无符号整数 当尝试使用64位无符号整数(例如Twitter ID)时,我遇到以下问题: // Array holding the 64 bit integer IDs of the Tweets in a timeline: NSArray *Ids =[timelineData valueForKeyPath:@"id"]; // I would like to get the minimum of these IDs: NSU

我想在iPhone4S(当然有32位ARM6处理器)上处理64位无符号整数

当尝试使用64位无符号整数(例如Twitter ID)时,我遇到以下问题:

// Array holding the 64 bit integer IDs of the Tweets in a timeline:
NSArray *Ids =[timelineData valueForKeyPath:@"id"];

// I would like to get the minimum of these IDs:
NSUInteger minId = (NSUInteger) Ids.lastObject;
数组
Ids
包含以下数字(=Tweet id):

但是,
minId
返回不正确的值
399999248
(而不是
491621445655867393


如何在iPhone 4s上找到64位整数数组中的最小或最后一个对象?

您需要使用始终为64位的类型,而不是
NSUInteger
。您可以使用
uint64\u t
unsigned long
。您还需要从NSNumber中获取整数值(数组不能存储C类型)。要做到这一点,你需要打电话

uint64_t minID = [Ids.lastObject longLongValue];
编辑
更改为在示例代码中使用uint64_t,正如正确指出的那样,这更好地显示了您的意图。

我将使用
uint64_t
表示您特别需要64位数据类型。
uint64_t minID = [Ids.lastObject longLongValue];