Contents
  1. 1. NSInteger 和 %@

NSInteger 和 %@

1
2
NSInteger age = 12;
NSString *str = age ? [NSString stringWithFormat:@"%@",age] : @"";
  • 上面代码看起来问题在%@,但最大的问题还在后面.
  • 运行起来会崩溃
  • 这里用%@,会去掉用description方法而NSInteger没有
Contents
  1. 1. NSInteger 和 %@