In my app, I am using Plists for making different lists. I want each Plist to be one list, and to be able to view all available lists in a TableView. To create the Plist I am using this:
NSString *plistname = [alertController.textFields[0].text stringByAppendingString:@".plist"];
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *pathFirstTime = [documentsDirectory stringByAppendingPathComponent:plistname];
[@{} writeToFile: pathFirstTime atomically: YES];
I went in to finder after getting the path, and verified the Plist file IS there.
I then am creating an NSArray of all the Plist in documents directory to be able to load into a TableView using this code, but it returns an empty array:
NSBundle *bundle = [NSBundle mainBundle];
NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
self.files = [bundle pathsForResourcesOfType:@"plist" inDirectory:documentsDirectory];
NSLog(@"%@", self.files);