Objective-C Language Logging


NSLog(@"Log Message!");
NSLog(@"NSString value: %@", stringValue);
NSLog(@"Integer value: %d", intValue);

The first argument of NSLog is an NSString containing the log message format. The rest of the parameters are used as values to substitute in place of the format specifiers.

The formatting works exactly the same as printf, except for the additional format specifier %@ for an arbitrary Objective-C object. This:

NSLog(@"%@", object);

is equivalent to:

NSLog(@"%s", [object description].UTF8String);