문제

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.

도움이 되었습니까?

해결책

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

다른 팁

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);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top