The usual way of getting App Document Directory path is given below.
Option (1)
- (NSURL *)applicationDocumentDirectory {
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true);
NSString *documentPath = [paths objectAtIndex:0];
NSURL *url = [NSURL fileURLWithPath:documentPath];
}
But Apple documentation suggest to use the following in iOS8:
Option (2)
- (NSURL *)applicationDocumentsDirectory
{
return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] lastObject];
}
In both ways I am getting the same value.
So there is confusion here. whether I should use the second option or not? is it a mandatory change in iOS 8?
Kindly give your suggestions?
我认为第二个选项应该更好,请阅读此答案https://stackoverflow.com/a/25885321/3800154
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.