问题
In iOS10 the NSlog are limited to 1024 characters has anybody know a workaround to print complete string.
回答1:
try printf then instead of NSLog like,
printf("%s", [string UTF8String]);
It may works
回答2:
I thinks this is a same question with [ NSLog on devices in iOS 10 / Xcode 8 seems to truncate? Why?, I will also post my answer here, in case you want to use printf instead.
This is a temporary solution,since I think it's a bug.
Just redefine all NSLOG to printf in a global header file.
#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
回答3:
a Swift workaround for this new Xcode8 and Sierra “feature”…
func Log(_ format:String, _ args:CVarArg...) {
let output = withVaList(args, { (p) -> NSString in
NSString(format: format, arguments: p)
}) as String
print( output )
}
Of course, this won’t have the features of NSLog that we may require such as the time stamp, bundle name, and thread stuff (including serialization).
来源:https://stackoverflow.com/questions/39538320/ios10-nslog-is-limited-to-1024-chars-strings