当我捕获异常时,我想在崩溃日志中留下一条消息。 NSLog() 有用吗?
在 catch 块中写下:
NSLog(@"%@", [e reason]);
其中 e 是 NSError 类的对象。
编辑:
@try { //Your Code } @catch (NSException * e) { NSLog(@"%@", [e reason]); }
上面的代码找出您的代码之间出现的任何异常。