asdasdfweqd23rf2f32 asdasdfweqd23rf2f32 - 3 months ago 17
iOS Question

Objective-C: debug line

I use code for show user number in debug. How to remove in only debug line

2016-08-20 13:02:52.773 1[37441:2806628]


for (int i=0; i<100; i++)
{
NSLog(@"user %d", i);
}


in debug I want to get

user1
user2
user3


and etc

But get this

2016-08-20 13:02:52.773 1[37441:2806628] user1
2016-08-20 13:02:52.773 1[37441:2806628] user2
2016-08-20 13:02:52.773 1[37441:2806628] user3


How I can remove this lines

2016-08-20 13:02:52.773 1[37441:2806628]
2016-08-20 13:02:52.773 1[37441:2806628]
2016-08-20 13:02:52.773 1[37441:2806628]

Answer

Use printf instead of NSLog:

for (int i=0; i<100; i++) 
 { 
   printf("User=%d\n",i); //Here \n is for new line
 }

Difference between NSLog and Printf statement for ObjectiveC

Comments