flickMik
flickMik

Reputation: 27

Contents of main bundle showing files that shouldn't exist

I've been experimenting with various file management things and I've run into something confusing. I created a .txt file and placed in the Supporting Files folder. In the program I then iterated through the contents of the main bundle to see if it was there:

// Get main bundle
NSBundle *myBundle = [NSBundle mainBundle];

// Collect all text files in main bundle
NSArray *textFiles = [myBundle pathsForResourcesOfType:@"txt"
                                           inDirectory:nil];

NSLog(@"%@", textFiles);

Pretty simple, and lo and behold it appeared. Great, perfect. However, here's where things get weird. I renamed the file, ran the thing again, and TWO files appeared - one that had the original name, and one that had the new name. Even though I didn't actually create a new file, just renamed the one.

Next I tried deleting the file and making a completely new one. When I ran it again, it told me there were still two files - the two from before. The new file I made wasn't shown. The old ones were, even though there was only ever one old file AND it had been deleted.

Even after deleting the app from the device and reinstalling it, the same thing happens. Where is it finding these files from? Why won't the new one appear? Any help would be greatly appreciated.

Upvotes: 1

Views: 426

Answers (1)

Mil0R3
Mil0R3

Reputation: 3956

In Xcode, You should choose Move to Trash not Remove Reference when deleting a file. Then you should clean the project before build it cause there may be some cache in Xcode.

Upvotes: 3

Related Questions