iOS 6, iPhone 5, Xcode 4.5
I have an app that let users download files from internet to documents folder, then populate them into an array then to a tableview. With iOS 5, my array and tableview automatically update with this code in viewWillAppear:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSArray *dataArray = [[NSBundle bundleWithPath:[paths objectAtIndex:0]] pathsForResourcesOfType:@"mp3" inDirectory:nil];
With iOS 6, I notice that the documents folder doesnt update itself when new files added/deleted, unless I quit the app (quit from multitasking at bottom) and reopen it, then it will reload the new data from documents folder.
Even when my app load viewWillAppear with the same code above, the data is still old. Seems like iOS 6 has a cache for documents folder now, and the cache doesnt update until app is restarted!
It worked perfectly fine in iOS 5.
Thanks for reading and helping 🙂
You should not use NSBundle to access files in the documents directory. Instead use NSFileManager: