我有一个SQLite数据库,我用它来存储应用程序数据,我可以查看它内部以调试我遇到的问题-但是iPhone模拟器通常在哪里存储它的数据?


当前回答

对于Xcode 4.6,它被存储在以下路径…

/Users/[currentuser]/Library/Application Support/iPhone Simulator/6.1/Applications/

要通过编程方式了解它,请使用以下代码

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

其他回答

如果有人仍然在lion中遇到这个问题,有一篇很棒的文章提供了19个查看~/Library目录的技巧。在这里找到Dan Frakes的文章http://www.macworld.com/article/161156/2011/07/view_library_folder_in_lion.html

记住模拟器的目录如下所示

~/库/应用程序支持/iPhone模拟器/用户/

在Xcode 5中,你可以使用以下代码:

#import <Foundation/NSFileManager.h>

and:

NSString *homeDir = NSHomeDirectory();
NSLog(@"%@",homeDir);

结果看起来像这样:

"/Users/<your user name>/Library/Application Support/iPhone Simulator/7.1/Applications/hhhhhhhh-hhhh-hhhh-hhhh-hhhhhhhhhhhh"

hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh是一个十六进制字符串,用来识别你的iOS应用程序。

iOS 8 ~ /图书馆/开发/ CoreSimulator /设备/[设备ID] /数据/应用程序/ [appGUID] /文件/

在iOS 5中:

/Users/[用户名]/库/应用程序支持/iPhone模拟器/5.0/应用程序/[AppGUID]/

对于Xcode 4.6,它被存储在以下路径…

/Users/[currentuser]/Library/Application Support/iPhone Simulator/6.1/Applications/

要通过编程方式了解它,请使用以下代码

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