1
我尝试将新行添加到NSlog
。NSlog不会打印新行 r n
我运行:
NSLog(@"\n%@\r\n\r\n", json1);
NSLog(@"\n%@\r\n\r\n", json2);
但是输出是:
2017-03-29 16:09:50 InAppTestAfApp2[312:33527]
{"attribution":"true"}
2017-03-29 16:09:50 InAppTestAfApp2[312:33527]
{"attribution":"false"}
它忽略新线\r\n
(也试过\n
只),但字符串前一日\n
工作
我期待:
2017-03-29 16:09:50 InAppTestAfApp2[312:33527]
{"attribution":"true"}
2017-03-29 16:09:50 InAppTestAfApp2[312:33527]
{"attribution":"false"}
017-03-29 16:09:50 InAppTestAfApp2[312:33527] other logs ...
我使用的Xcode 8.3
[编辑1]
我试图运行:
NSLog(@"%@ %@",type, @"xxxxx\n\n");
不过我看到:
2017-03-29 16:09:50 InAppTestAfApp2[312:33527]
xxxxx
017-03-29 16:09:50 InAppTestAfApp2[312:33527] other logs ...
[EDIT 2]
由于工作围绕我在末尾添加垃圾,但它看起来凌乱:
NSLog(@"%@ %@\r\n\r\n%s",type, json, @"`");