Nslog on Devices in iOS 10/Xcode 8 Seems to Truncate - Why

NSLog on devices in iOS 10 / Xcode 8 seems to truncate? Why?

A temporary solution, just redefine all NSLOG to printf in a global header file.

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

iOS10 NSLog is limited to 1024 chars strings

try printf then instead of NSLog like,

   printf("%s", [string UTF8String]);

It may works

Why are NSLogs in Xcode 8 cut off?

I was able to figure this out with the help of This question

You have to create a global header (YourProjectName.pch) Then post this line:

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

Then you can call NSLog like normal from any view like NSLog(@"My array data: %@", anArray);

Does XCode ever truncate device's console logs

No, XCode never truncate device's console logs.Also you can view its outputs with your device connected to your Mac and using Xcode Organizer tool.

Note:-

The above point is applicable only to the prior version of Xcode 8

Hide strange unwanted Xcode logs

Try this:

1 - From Xcode menu open: Product > Scheme > Edit Scheme

2 - On your Environment Variables set OS_ACTIVITY_MODE = disable

Screenshot



Related Topics



Leave a reply



Submit