У меня есть структура, подобная следующей, в моем проекте Xcode.
Мне нужно прочитать все изображения из проекта и сохранить их в массиве.
Я использовал следующий код из некоторых других сообщений StackOverflow, но он не работает.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *filePath = [[NSBundle mainBundle] pathForResource:@"Images"ofType:@""];
NSDirectoryEnumerator *direnum;
direnum = [fileManager enumeratorAtPath: filePath];
imageFolder = [NSMutableArray new];
for(NSString *filename in direnum){
if([[filename pathExtension] isEqualToString:@"png"]){
[imageFolder addObject:filename];
}
}
NSLog(@"Files in the folder %@",imageFolder);
Я был бы признателен, если бы кто-нибудь помог мне завершить это.