【发布时间】:2013-11-17 02:03:32
【问题描述】:
我尝试在 64 位模式下运行时得到的确切错误是 Format specifies type 'int' but the argument has type 'long'。
我可以通过将 %d 更改为 %ld 来修复此错误,但是当我在 32 位(正常)模式下运行应用程序时,我收到一条错误消息:Format specifies type 'long' but the argument has type 'int'
如何同时考虑 64 位和 32 位?我创建了一个 if(condition) 吗?
- (void)pickerView:(UIPickerView *)pickerView didSelectRow: (NSInteger)row inComponent:(NSInteger)component {
// Handle the selection
if(pickerView.tag == 1){
start = row+1;
[startButton setTitle:[NSString stringWithFormat:@"%d. %@", row+1, [stops objectForKey:[NSString stringWithFormat:@"%d", row+1]]] forState:UIControlStateNormal];
}else if (pickerView.tag == 2){
stop = row+1;
[endButton setTitle:[NSString stringWithFormat:@"%d. %@", row+1, [stops objectForKey:[NSString stringWithFormat:@"%d", row+1]]] forState:UIControlStateNormal];
}
}
【问题讨论】:
-
请注意,long long 和 unsigned long long 在 32 位和 64 位处理器上都是 64 位。
-
long long 不会比普通的 int 占用更多的空间吗?这对于仅运行 32 位的 iPhone 是否实用?
-
它将占用 64 位(8 字节),但除非您有数千位,否则又如何。请注意,这不是答案,只是信息,请参阅下面的答案。
标签: iphone objective-c xcode 64-bit 32bit-64bit