The following is a common way to get the application document catalog directory.
Option 1)
- (NSURL *)applicationDocumentDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true);
NSString *documentPath = [paths objectAtIndex:0];
NSURL *url = [NSURL fileURLWithPath:documentPath];
}
But Apple Documentation suggests using the following in iOS8:
Option (2)
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject];
}
In both cases, I get the same value.
So there is confusion here. should i use the second option or not? is this a mandatory change in iOS 8?
Please give your suggestions?
source
share