0
try 블록에 코드 블록을 배치 한 프로젝트를 개발 중입니다.예외가 발생한 정확한 지점을 얻는 방법은 무엇입니까?
이 블록에는 imageView에 이미지를 할당하기 위해 5 개의 명령문이 있습니다 (리소스 폴더에서 이미지를 추가 할 이미지 뷰가 5 개 있습니다). 리소스 폴더에 이미지가 없으면 흐름을 catch 블록으로 건너 뜁니다.
이미지를 할당 할 수 있도록 예외가 발생하는 정확한 문장을 알고 싶습니다. nil
.
@try {
if (indexPath.row%2==0) {
cell.bookImageView1.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+0].titleImage;
cell.bookImageView2.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+1].titleImage;
cell.bookImageView3.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+2].titleImage;
cell.bookImageView4.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+3].titleImage;
cell.bookImageView5.image=nil;
}else {
cell.bookImageView1.image=nil;
cell.bookImageView2.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+0].titleImage;
cell.bookImageView3.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+1].titleImage;
cell.bookImageView4.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+2].titleImage;
cell.bookImageView5.image=[[KitabooBookListDataSource sharedDataSource] bookAtIndex:(indexPath.row*4)+3].titleImage;
}
}
@catch (NSException *e) {
NSLog(@"catch block");
NSLog(@"array of exception %@",[e callStackReturnAddresses]);
//NSMutableArray *catchArray=[[NSMutableArray alloc] initWithArray:[e callStackReturnAddresses]];
//[[catchArray lastObject] ]=nil;
}
어떤 유형의 예외가 발생 했습니까? 대답은 그것에 달려 있습니다. – Yuji