1
是否有下列原因不起作用?Objective-c Try/Catch not catchching
@try {
CFGetTypeID(NULL);
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
NSLog(@"finally");
}
與try/catch question類似,只是看起來上面的塊每次都崩潰。我知道我的調試器設置正確,因爲我建立一個try /上述來自其它問題捉:
// Test working try catch
NSString* test = [NSString stringWithString:@"ss"];
@try {
[test characterAtIndex:6];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
NSLog(@"finally");
}
// Now test NULL entry
@try {
CFGetTypeID(NULL);
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
NSLog(@"finally");
}