I was curious if anyone knew how to use a try catch in objective c in order to print out a possible NSError received from a synchronousRequest.
我很好奇是否有人知道如何在目标c中使用try catch以打印出从synchronousRequest接收的可能的NSError。
The error that I am receiving is due to a non valid memory address. my try catch looks like
我收到的错误是由于无效的内存地址。我试试看起来像
@try{
NSLog(@"%@", err);
}@catch(NSException *e){
NSLog(@"No error thrown");
}
1 个解决方案
#1
1
The @catch
block should contain the code that you want to run if there is an error.
@catch块应包含在出现错误时要运行的代码。
@try {
// Do the request
NSLog(@"No error thrown");
} @catch (NSException *e) {
NSLog(@"%@", err);
}
#1
1
The @catch
block should contain the code that you want to run if there is an error.
@catch块应包含在出现错误时要运行的代码。
@try {
// Do the request
NSLog(@"No error thrown");
} @catch (NSException *e) {
NSLog(@"%@", err);
}