stringWithFormat应该返回一个字符串,为什么这个语句不能编译
NSAssert(YES, [NSString stringWithFormat:@"%@",@"test if compiles"]);
什么时候
NSAssert(YES, @"test if compiles");
编译?
最佳答案
将此用作:
NSAssert(YES, ([NSString stringWithFormat:@"%@",@"test if compiles"])); // Pass it in brackets ()
希望对您有帮助。