我正在尝试访问应用程序文件夹,该文件夹允许在不越狱的情况下进行读取访问,但我得到一个空数组
NSArray *appFolderContents=[[NSFileManager defaultManager]
directoryContentsAtPath:@"/var/mobile/Applications"];
最佳答案
您可以像这样访问您的应用程序目录
NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSLog(@"App Directory is: %@", appFolderPath);
NSLog(@"Directory Contents:\n%@", [fileManager directoryContentsAtPath: appFolderPath]);
请注意,您只能在根文件夹中读取,并在应用的 Documents
文件夹中写入和读取。
您无权访问应用程序包之外的任何文件夹。
关于ios - 无需越狱访问应用程序文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23870062/