iOS 10 Doesn't Print Nslogs

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]);

NSLog not printing to console

Well, this is embarrassing. The console got deactivated somehow and I was actually watching the variables window. Pressing Shift + + C did the trick.

Many thanks to Robert King on this thread:

https://devforums.apple.com/message/565880#565880

iOS10 NSLog is limited to 1024 chars strings

try printf then instead of NSLog like,

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

It may works

Xcode 8 Does not display the whole NSLog output

As @Lion described in his comment the easiest possible way is to use printf instead. It does not work exactly like NSLog but it shows what you want.

NSDictionary *allProducts = responseFromAPI;
NSString * string = [NSString stringWithFormat: @"%@", allProducts];
printf("%s", [string UTF8String]);

or shorter:

NSDictionary *allProducts = responseFromAPI;
printf("%s", [NSString stringWithFormat: @"%@", allProducts].UTF8String);

A tip is to place a "\n" at the beginning or end of the printf format so it will separate the outputs and not put all in a single line. Something like this:

printf("%s\n", string.UTF8String);

If you don't like writing printf instead every time you can use a #define to redirect the code to an printf like this (code from @xfdai):

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

Hopefully this is just a bug from Apple that will get fixed soon, until then we can use this.

When I call objective-c functions from Swift, NSLog in those functions do nothing

It seems like the property "OS_ACTIVITY_MODE": "disable" PREVENTS NSlog from showing up in the Xcode 9 log.

Uncheck this value in my scheme restored my logs.

Check this stack overflow post - iOS 10 doesn't print NSLogs

Xcode 9, where are my NSLog()s going? Not showing in Xcode console or Console.app

Figured it out. It's not an intermittent issue or one that can just be fixed with a restart. It's a Run configuration issue.

Click on the Run Scheme selector in the top left of Xcode's toolar.

Click Manage Schemes.

Sample Image

Click on your main App Project.

Click the Edit button in the bottom left.

Sample Image

Uncheck OS_ACTIVITY_MODE.

Click Close.

Viola. All your console logs come back.

Sample Image



Related Topics



Leave a reply



Submit