I was reading about Plist just before and I saw this Bit of code:
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"projects" ofType:@"plist"];
projects = [NSArray arrayWithContentsOfFile:path];
}
Now I've been manually putting in the file path of my property list, I'm curious is this the correct way to universally find the file path?
if so could someone please explain how it works to me, thanks.
Yes, for getting the file from your Main resources bundle.
For getting the resource path from you application document directory you can try like
/**
Returns the URL to the application's Documents directory.
*/
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
}
which could be use like
NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"yourFile.ext"];