Domanda

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.

È stato utile?

Soluzione

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

Altri suggerimenti

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);
}
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top