Objective-c – How to do the equivalent of println in Objective-C

objective c

In Java, I would do this:

String temp = ".";
System.out.println(temp);

How might I do that in Objective-C?

Best Answer

Objective-C doesn't really have its own dedicated printing function. NSLog will print what you give it along with a bunch of debugging information. For straight-up printing, the C printf() is still basically the standard. As the equivalent to your code, I'd write:

NSString *temp = @".";
printf("%s\n", [temp UTF8String]);