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

问题描述 投票:0回答:3

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

我怎样才能做到这一点?

ios file directory
3个回答
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);

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


1
投票

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

然后运行你的应用程序

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

如果您没有物理设备,那么您只有Fiona的答案


0
投票

去:

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

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

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

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

© www.soinside.com 2019 - 2024. All rights reserved.