Xcode 8 Does not display the whole NSLog output Xcode 8 Does not display the whole NSLog output ios ios

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.


You can use this method. Split every 800 chars. Or can be set. NSLOG I think truncate every 1000 chars. If string is less than 800 will use a simple NSLog. This is useful for Json long strings and uses the console. printf uses Xcode debug window not the console.

-(void) JSLog:(NSString*)logString{        int stepLog = 800;        NSInteger strLen = [@([logString length]) integerValue];        NSInteger countInt = strLen / stepLog;        if (strLen > stepLog) {        for (int i=1; i <= countInt; i++) {            NSString *character = [logString substringWithRange:NSMakeRange((i*stepLog)-stepLog, stepLog)];            NSLog(@"%@", character);        }        NSString *character = [logString substringWithRange:NSMakeRange((countInt*stepLog), strLen-(countInt*stepLog))];        NSLog(@"%@", character);        } else {        NSLog(@"%@", logString);        }}