有没有办法通过代码找到当前iPhoto库的路径?
发布于 2012-09-12 04:38:24
您可以访问位于中的com.Apple.iApps plist文件
/用户/用户名/库/首选项/
在这里,您将找到列出iApp数据库(包括iTunes和iPhoto)的最新位置的关键字。这将允许您自动查找iPhoto库的位置,无论用户选择将其放置在何处。
NSArray *libraryDatabases = [[[NSUserDefaults standardUserDefaults] persistentDomainForName:@"com.apple.iApps"] objectForKey:@"iPhotoRecentDatabases"];
NSURL *libraryURL = (([libraryDatabases count])) ? [NSURL URLWithString:[libraryDatabases objectAtIndex:0]] : nil;此NSURL返回当前iPhoto库的位置(如果存在)。
https://stackoverflow.com/questions/12377429
复制相似问题