模拟器8.0存储文件在哪里

时间:2014-06-03 18:40:41

标签: ios-simulator ios8 xcode6

我在Icode 8的Xcode-6 Beta中找不到新模拟器数据的目录

它不在 〜/ Library / Application Support / IPhone Simulator /

Where does the iPhone Simulator store its data?

7 个答案:

答案 0 :(得分:34)

这样的事情:

/Users/{YOUR NAME}/Library/Developer/CoreSimulator/Devices/{DEVICE ID}/data/Containers/Data/Application/{APPLICATION ID}/

设备ID可能有点难以找到(基本上,每个模拟器都有一个带有随机名称的文件夹)。为了找到正确的文件夹,我使用了这个终端命令:

find ~ -name myFile.txt

myFile.txt是我的应用程序中的一个文件。终端然后打印出完整的位置 - 如果您有一个可以搜索的文件(或者可以制作一个文件),这对您来说可能更有用,然后逐个检查。

答案 1 :(得分:12)

在XCode 6中,很难找到答案。但我这样做的方式很简单:

打开XCode后,只需在Debug Area中写下:

po [NSBundle mainBundle]

或记录:

NSLog(@"%@", [NSBundle mainBundle]);

结果是这样的: enter image description here

之后,您可以打开终端应用程序并使用此命令转到路径:

打开yourAppPath ...


[更新]

我找到了一个很棒的应用程序:http://simpholders.com/

答案 2 :(得分:2)

要在iOS 8 Simulator中找到应用程序的 Documents 文件夹,您可以先在Documents文件夹中写入文件:

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fileName = [documentsDirectory stringByAppendingPathComponent:@"Words.txt"];
NSString *content = @"Apple";
[content writeToFile:fileName atomically:NO encoding:NSStringEncodingConversionAllowLossy error:nil];

说,在didFinishLaunchingWithOptions

然后你可以打开终端并找到文件夹:

$ find ~/Library -name Words.txt

答案 3 :(得分:1)

好吧,我试图手动找到东西感到很沮丧。我将上面的笔记保留在上面,以显示哪些内容似乎不起作用。

SimPHolders,对我来说有什么用,对我来说是一个很大的安慰。谷歌一下。下载它。运行。享受。

答案 4 :(得分:0)

XCode6中的模拟器目录移动到:

Library ▸ Developer ▸ CoreSimulator

应用程序文件夹的完整路径:

~/ ▸ Library ▸ Developer ▸ CoreSimulator ▸ Devices ▸ 5D71993D-78C2-49F4-9B30-99D0307D3A2F ▸ data ▸ Containers ▸ Data ▸ Application ▸ AE50273B-993C-45DA-97E8-3F88E4B64BDE ▸ Documents ▸ xyz.sqlite

答案 5 :(得分:0)

打开模拟器后,转到硬件 - >设备 - >管理设备。

一个窗口显示,概述了每个可用的模拟器,以及每个模拟器的唯一标识符。

因此,在Finder中导航到~Library / Developer / CoreSimulator之后,您可以通过查找唯一标识符来判断其中哪些目录包含您想要的模拟器。

进入那里后,你仍然需要进一步向下钻取......在我的情况下,我发现我必须导航到数据/容器/数据/应用程序,然后查找今天有日期的文件夹。

最后!我到达了我熟悉的文档和图书馆文件夹。

再次感谢Apple,让我们保持iOS开发人员的有效就业!

答案 6 :(得分:0)

您可以在应用程序委托中添加NSLog" didFinishLaunchingWithOptions"方法,所以他们打印你的路径

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if TARGET_IPHONE_SIMULATOR
    NSLog(@"APP BUNDLE :: %@", [NSBundle mainBundle]);
    NSLog(@"APP DOCUMENTS :: %@", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
#endif
...
相关问题