Ian*_*ber 4 iphone objective-c nsstring
完全失去了这一个.这是我的代码:
theColor = [NSString stringWithFormat:@"white"];
NSLog(@"%s", theColor);
Run Code Online (Sandbox Code Playgroud)
哪个是退缩:
†t†å
Run Code Online (Sandbox Code Playgroud)
我必须做一些愚蠢的事情,但无法弄清楚我的生活.
将您的打印更改为:
NSLog(@"%@", theColor);
Run Code Online (Sandbox Code Playgroud)
希望能帮助到你.
问题是%s需要一个C字符串(带有NULL终结符的char数组),并且您传递的NSString实例与C字符串不同.以打印NSString内容的格式所需的修饰符是%@.
| 归档时间: |
|
| 查看次数: |
82 次 |
| 最近记录: |