gpt4 book ai didi

ios - 无需越狱访问应用程序文件夹

转载 作者:行者123 更新时间:2023-11-29 02:56:18 47 4
gpt4 key购买 nike

我正在尝试访问应用程序文件夹,该文件夹允许在不越狱的情况下进行读取访问,但我得到一个空数组

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/

47 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com