如何在 Xcode 中查看我的 iOS 应用程序创建的文件/目录

mrd*_*mrd 2 directory file ios

我有一个应用程序,我想在 Xcode 9 中检查该应用程序在我的 iPhone 上创建的文件和目录。

我怎样才能做到这一点?

SWA*_*WAT 10

去:

窗口 -> 设备和模拟器 -> 选择您的设备 -> 选择您的应用

使用“齿轮”图标和“下载容器”。将此文件保存在您喜欢的任何位置,然后通过右键单击该文件并“显示包内容”来访问它

这将显示保存在应用程序文档目录和应用程序内其他文件夹中的文件。当然,这不会在您下次运行时自行更新。

如果您使用的是模拟器,您可以通过以下方式访问内容文件夹:~/Library/Developer/CoreSimulator/Devices/[DeviceID]/


小智 5

如果您有物理设备,您可以在 info.plist 中添加UIFileSharingEnabled键并将其值设置为YES

然后运行你的应用程序

打开 iTunes 选择设备并转到文件共享并选择您的应用程序,您将看到由您的应用程序创建的文件

如果您没有物理设备,那么您唯一的选择就是菲奥娜的答案


Fio*_*off 1

尝试这个

NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
NSString *sourcePath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"Populator"];
NSString *folderPath = [documentsDirectory stringByAppendingPathComponent:@"Files"];
NSLog(@"Source Path: %@\n Documents Path: %@ \n Folder Path: %@", sourcePath, documentsDirectory, folderPath);
Run Code Online (Sandbox Code Playgroud)

这将为您提供文件路径。现在,在桌面打开 Finder 中,按Shift + Command + G,粘贴路径,然后按“Go”。