4

I was trying to print an array of dictionaries. The dictionary contains 300 keys and their values. There are about more than 6000 dictionaries in the array. But NSLog could print the array when the number of dictionaries in it were less than 3300. When i tried to add more number of dictionaries in the array(>3300),the array was not getting printed. I was getting blank in the xcode console. Is there a certain limit to which NSLog can print values?

triandicAnt
  • 1,328
  • 2
  • 15
  • 40
  • 1
    can you add some of your code please, i don't think this is a nslog issue. – rezand Jun 24 '13 at 16:33
  • NSLog is just an added form of `printf`, so i guess it can hold as much as `printf` can. This depends on on the available memory... – Anoop Vaidya Jun 24 '13 at 16:53
  • There are practical, if not specified, limits. You need to somehow break up your request into smaller units. (If nothing else, you can spend a lot of time simply waiting for NSLog to format and internally print the data, before you get to begin viewing it. If broken into smaller pieces you get to look at it sooner.) – Hot Licks Jun 24 '13 at 17:52
  • Adding to what Hot Licks said, it should be easy enough to enumerate through the array using a for loop and call NSLog() on each individual dictionary object. – Jay Wardell Jun 25 '13 at 01:58
  • I am able to print individual dictionary objects. however if trying to print whole array..its taking considerable time. – triandicAnt Jun 25 '13 at 05:35

1 Answers1

2

NSLog prints 1022 chars

if you want to extend NSLog print limit,you may redefine NSLog to printf in global header file

#define NSLog(FORMAT, ...) printf("%s\n", [[NSString stringWithFormat:FORMAT, ##__VA_ARGS__] UTF8String]);
Add080bbA
  • 1,818
  • 1
  • 18
  • 25