Objective c 调用stringWithFormat时长时间使用哪个说明符是正确的?
我有这段代码,它运行得很好,但我不知道调用stringWithFormat是否正确,因为在文档中%d代表int,我传递了一个长消息:Objective c 调用stringWithFormat时长时间使用哪个说明符是正确的?,objective-c,ios,Objective C,Ios,我有这段代码,它运行得很好,但我不知道调用stringWithFormat是否正确,因为在文档中%d代表int,我传递了一个长消息: long seconds = (long)[[NSDate date]timeIntervalSince1970]; NSString *unixTimestamp = [NSString stringWithFormat:@"date=%d", seconds]; 提前谢谢 试试%ld: NSString *unixTimestamp = [
long seconds = (long)[[NSDate date]timeIntervalSince1970];
NSString *unixTimestamp = [NSString stringWithFormat:@"date=%d", seconds];
提前谢谢 试试%ld
:
NSString *unixTimestamp = [NSString stringWithFormat:@"date=%ld", seconds];
来自文档的摘要(NSString的stringWithFormat格式遵循与printf函数相同的标准):
l(厄尔)指定以下d、i、o、u、x或x转换 说明符应用于长参数或无符号长参数