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.
Click on your main App Project.
Click the Edit button in the bottom left.
Uncheck OS_ACTIVITY_MODE
.
Click Close.
Viola. All your console logs come back.
Related Topics
How to Integrate Nsurlconnection with Uiprogressview
How to Create a Glow Around a Sprite via Skeffectnode
How to Apply a Tintcolor to a Uiimage
"Interfaceorientation" Is Deprecated in iOS 8, How to Change This Method Objective C
Auto Layout Constraint on Calayer iOS
When Will Applicationwillterminate Be Called
iOS Glsl. How to Create an Image Histogram Using a Glsl Shader
Xcode 7.1 Swift 2 Unknown Class in Interface Builder File
App Submission Binary Does Not Show Up in Itunes Connect
Xcode 8 Objective-C Category Warning
Fbsopenapplicationerrordomain Code =4 Error
New Foursquare Venue Detail Map
Don't Launch Simulator When Running Unittests
How to Set a Default Value of a Uipickerview
How to Set Uiviewcontroller "Extend Edges" Properties
Calling Uiviewcontroller Method from App Delegate
Nslocalizedstring Only Retrieves the Key, Not the Value in Localizable.Strings (Ios)