Why aren't the files in my NSBundle folder for iPhone deleted?

It’s hard for me to understand why the files in my iPhone app seem to be saved even when I deleted them. Here is the code that dislikes me:

NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
NSString *folderPath = [bundlePath stringByAppendingPathComponent:@"filefolder"];
NSArray *fileNames = [fileManager contentsOfDirectoryAtPath:folderPath error:NULL];

This code should search for the "filefolder" folder and read its contents in the file names. When I launch this application for the first time, it will do it. But if I change the contents of the file folder (for example, if I add or delete files) and I create and run the application again, the file names of the array will contain the names of all the recently added files (well), but also contain the names of all the files that should have been deleted (bad) !!

Can someone help me understand why I see this behavior?

+3
source share
1 answer

Did you do a “Clear” in Xcode after adding / removing new elements from the package? This usually solves the problem of "obsolete" resources.

+1
source

Source: https://habr.com/ru/post/1765740/


All Articles