Frage

Can I add NSLog in my model class's implementation. So when I call that method where I have inserted NSLog , from the controller , I should get the strings from that NSLog on my console.

Can I do that ? I tried doing it in my code but I am not sure if it should work or not.

War es hilfreich?

Lösung

You can put NSLog wherever you like. It's a macro.

Andere Tipps

It can be used anywhere, without a doubt.

NSLog() is an extended printf() for Objective-C.Its is a Foundation function, accepting a constant NSString as format, having extended format specifier set. It also prints the process name and date before it prints the actual format and writes to sdterr.

You could. But its unnecessary to have a method just for NSLog.

-(void)print:(NSString * )text{
  NSLog("%@", text);
}
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top