我有一个应用程序,我想用Xcode9检查应用程序在我的iPhone上创建的文件和目录。
我该怎么做呢?
发布于 2018-03-06 18:48:16
请转至:
Window ->设备和模拟器->选择您的设备->选择您的应用程序
使用“齿轮”图标和“下载容器”。将此文件保存在您喜欢的任何位置,通过右键单击该文件并单击"Show Package Content“来访问它
这将显示保存在应用程序的文档目录和应用程序中的其他文件夹中的文件。当然,这不会在你下一次运行时自动更新。
如果您使用的是模拟器,则可以通过转到:~/Library/Developer/CoreSimulator/Devices/DeviceID/来访问contents文件夹
发布于 2018-03-06 18:28:20
如果您有物理设备,可以在info.plist中添加UIFileSharingEnabled密钥,并将其值设置为YES
然后运行你的应用程序
打开iTunes,选择设备,转到文件共享,然后选择您的应用程序,您将看到由您的应用程序创建的文件
如果你没有物理设备,那么你唯一的选择就是菲奥娜的回答
发布于 2018-03-06 18:16:36
尝尝这个
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);这将为您提供文件路径。现在在桌面Open Finder中,按Shift + Command + G,粘贴路径,然后按Go。
https://stackoverflow.com/questions/49128223
复制相似问题