Reputation: 199
I am developing for iOS 5. What I would like to do is read the list of files in my app's Documents Directory and list them in the UITableView. I found an article on StackOverflow, but the API's used have been deprecated. Any ideas on what to do here?
Upvotes: 1
Views: 2344
Reputation: 50727
You can insert the files of the directory into an NSArray
and list them in the cells like this:
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSArray *fileListAct = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:nil];
cell.textLabel.text = NSString stringWithFormat:@"%@",[fileListAct objectAtIndex:indexPath.row]];
This still works in iOS5 and has not been deprecated.
Upvotes: 2