LoginSignup
9
6

More than 5 years have passed since last update.

Xcode8+iOS10開発でNSLogの出力文字数が制限される問題

Last updated at Posted at 2016-11-17

私はAPIからの戻り値などをXcodeのデバッグエリアに全文出力して確認していたんですが、Xcode8になってから1,000byte程度しか文字が出力されないようになって困っていました。

Xcode依存の問題かと思い色々と調べていましたが、原因はNSLogにあったようです。
(Xcode8 + Debug Area や Xcode8 + All Output lengthなどでは全くみつからなかった)

対策

printfを使う

■ iOS10 NSLog is limited to 1024 chars strings
http://stackoverflow.com/questions/39538320/ios10-nslog-is-limited-to-1024-chars-strings/

こちらで紹介されているように、以下のdefineでNSLogを置き換えるのが便利です。

#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6