Where Does Simulator 8.0 Store Files

2019-01-23 04:09发布

I cannot find the directory for the new simulator data in Xcode-6 Beta for IOS 8

It is not in ~/Library/Application Support/IPhone Simulator/

Where does the iPhone Simulator store its data?

7条回答
我欲成王,谁敢阻挡
2楼-- · 2019-01-23 04:10

To locate the Documents folder of an app in iOS 8 Simulator, you can first write a file in the Documents folder:

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];

say, in didFinishLaunchingWithOptions.

Then you can open a Terminal and find the folder:

$ find ~/Library -name Words.txt
查看更多
ゆ 、 Hurt°
3楼-- · 2019-01-23 04:18

Something like this:

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

The Device ID can be a bit hard to find (basically, there's one folder with a random-looking name for each simulator you have). To get to the correct folder, I used this terminal command:

find ~ -name myFile.txt

Where myFile.txt was one of the files in my application. The terminal then printed out the full location—this might be more useful to you then checking each one-by-one, if you have a file (or, can make one) that you can search for.

查看更多
我想做一个坏孩纸
4楼-- · 2019-01-23 04:27

In XCode 6 it's really hard to find out. But I do this in the simple way:

With XCode opened just write this in Debug Area:

po [NSBundle mainBundle]

Or logging:

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

The result is something like that: enter image description here

After that you can open Terminal app and go to path with this command:

open yourAppPath...


[Update]

I found an amazing app to do this: http://simpholders.com/

查看更多
冷血范
5楼-- · 2019-01-23 04:27

Simulators directory in XCode6 is moved to:

Library ▸ Developer ▸ CoreSimulator

Full Path to Application folder:

~/ ▸ Library ▸ Developer ▸ CoreSimulator ▸ Devices ▸ 5D71993D-78C2-49F4-9B30-99D0307D3A2F ▸ data ▸ Containers ▸ Data ▸ Application ▸ AE50273B-993C-45DA-97E8-3F88E4B64BDE ▸ Documents ▸ xyz.sqlite
查看更多
放我归山
6楼-- · 2019-01-23 04:28

Ok, I was frustrated trying to find things manually. Ill keep my notes above to show what does NOT seem to work.

What DOES work, and is a great relief to me, is SimPHolders. Google it. Download it. Run it. Enjoy.

查看更多
我只想做你的唯一
7楼-- · 2019-01-23 04:31

You can add NSLogs in application delegate "didFinishLaunchingWithOptions" method, so they print your paths

- (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
...
查看更多
登录 后发表回答