내 리소스 폴더에서 "hit_circle_0.png"~ "hit_circle_19.png"이미지가 있지만 어떤 이유로이 코드는 "found"에 대한 테스트를 통과하지 않습니다. 성가신 일은 다른 메서드에서 작동하는 똑같은 기능입니다. 그 아래에. 그리고 파일은 "복사 번들 리소스"에있다왜 이러한 이미지에 대해 올바른 pathForResource를 찾지 못합니까?
NSMutableArray *hitCircle = [[NSMutableArray alloc]init];
for (int i = 0; i < 20; i++) {
NSString *name = [NSString stringWithFormat:@"hit_circle_%i", i];
NSString *filePath= [[NSBundle mainBundle] pathForResource:name ofType:@"png"];
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]){
NSLog(@"file %@ was found", filePath);
} else{
NSLog(@"%@ not found", filePath);
}
}
파일 이름을 확인 하시겠습니까? iOS 파일 시스템은 대소 문자를 구분합니다. –