如何在objectiveC中将NSUInteger值转换为int值?

GR.*_*GR. 26 int objective-c nsuinteger ios

如何在objectiveC中将值转换NSUIntegerint值?

以及如何打印NSUInteger价值NSLog,我试过%@,%d,%lu这些不起作用,并抛出Ex-Bad Access错误.

谢谢

Gir*_*ish 75

NSUInteger intVal = 10;
int iInt1 = (int)intVal;
NSLog(@"value : %lu %d", (unsigned long)intVal, iInt1);
Run Code Online (Sandbox Code Playgroud)

有关更多参考,请看这里