objective-cxcodedebuggingnslog

Using NSLog for debugging


I have the following code snippet in my Xcode:

NSString *digit [[sender titlelabel] text];
NSLog([digit]);

I tried to build the application and am getting the following warning message for the line NSLog([digit]);

Warning: Format not a string literal and no format arguments

Can you advise me how I can resolve this warning message? What does the message actually mean?


Solution

  • Try this piece of code:

    NSString *digit = [[sender titlelabel] text];
    NSLog(@"%@", digit);
    

    The message means that you have incorrect syntax for using the digit variable. If you're not sending it any message - you don't need any brackets.