Using NSLog for debugging

前端 未结 6 2226
暗喜
暗喜 2020-12-16 10:02

I have the following code snippet in my Xcode:

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

I tried to build the application

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-16 10:46

    Why do you have the brackets around digit? It should be

    NSLog("%@", digit);

    You're also missing an = in the first line...

    NSString *digit = [[sender titlelabel] text];

提交回复
热议问题