I need to look my application's database file.I found this question:
How view data stored in Core Data?
In answer he said:
Your app will be folder inside (~ is your home directory):
~/Library/Application Support/iPhone Simulator/User/Applications/
I opened the Application Support folder but there is no iPhone Simulator folder inside this folder.
What should I do ? Here is the screenshot:
Edit:I am using xCode 6 and Yosemite.
The iPhone Simulator files have moved and can be a bit of a pain to find now. Each simulated device has a folder in ~/Library/Developer/CoreSimulator/Devices. You can root around in there until you find the simulator you're looking for. I wrote a tool to help locate the sandbox for each simulated device on which you've installed an app, but it's not perfect. You can find it here: https://github.com/somegeekintn/SimDirs
There is also an app called SimPholders2 that may be able to help you with this problem - http://simpholders.com/
for me it it is Library/Developer/CoreSimulator/Devices/C7E8D457-BFAB-43DA-8B0C-D9010BBB1D88/data/Containers/Data/Application/6B7DC6FA-2379-468C-A74B-60910A1CDCD1/Documents
device id and application id will be different for you though. this would give you documents directory for your app.
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSLog (#"documentsDirectory %#",documentsDirectory);
OK The whole Problem lies in the fact that you need to open the Finder >> View >> Show View Options and then click to turn on Library.
Why would someone hide this so deep and obscurely?
You can use Core Data Lab to automatically find and view the database files of any Core Data app running in the simulator.
Info page: https://betamagic.nl/products/coredatalab.html
Free 14-trial: https://betamagic.nl/downloads/Core%20Data%20Lab%20Trial.zip
Diclaimer: I'm the creator of this tool.
Related
I am using FMDatabase in my project I need to check the data in the table. Is there any tool or anything else that will help me see the db entries which is on real device ?
If you want to check data from of your applications sqlite file check it on simulator version is easy. Where you initialise database, print documentDirectory path in your application:
// Get Document Directory path of the device.
- (NSString*) documentsDirectory{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
return [paths objectAtIndex:0];
}
Navigate to that path in Explorer by cmd+G and pasting the path in text box. You'll see one .sqlite file in that folder. Open it with any sqlite explorer, I use Mozilla AdOn or SQliteManager.
But if you wanna check db from your device:
Open device manager Xcode
Select your device
Click on installed app installed app in right pan
Select your app
Download it (see attached image)
And then explore the package to find sqlite file in it.
I have been clearing some space from my drive and noticed that there are 183 folders inside my Developer>CoreSimulator>Devices folder. Are all of these required or are some of these simulators for older versions of iOS. When I look inside some of the folders they contain a file called device.plist that says the Sim Runtime is iOS-8-4. Is there any way to remove these old files?
Thanks
~/Library/Developer/CoreSimulator
Core Simulator folder is familiar for many Xcode users. It’s simulator’s territory; thats where it stores app data. It’s obvious that you can toss the older version simulator folder/folders if you no longer support your apps for those versions. And, it’s safer to use ‘Reset content and Settings’ option from menu to delete all of your app data in a Simulator.
Tip:
Objective-C
[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject];
Swift
NSFileManager.defaultManager().URLsForDirectory(NSDocumentDirectory, inDomains: NSUserDomainMask).lastObject()
Will print the full path to the document directory folder.
I have an app that creates a file in the iCloud documents folder. It is working fine, in that the devices that the app is installed on can access and update the file successfully. In my code, a NSLog of the file path gives me:
///private/var/mobile/Library/Mobile%20Documents/iCloud~my-company-name~appname/Documents/document_name
As part of my testing, I need to be able to view this file from my mac. Previously, I was able to do this by looking in my library/Mobile documents folder at the respective app folder.
However, I can't see the app folder in there. Any ideas why this would now not be showing up or pointers to configuration settings I could check? (I'm on Xcode 6.1, mac is Yosemite and all devices are iOS8).
Finder now treats this as a 'special' folder, so actively prevents you browsing the structure. You can do this if you use Terminal instead.
I seem to remember a way to get to the iOS Simulator file system from within the Xcode 6.0 or iOS Simulator GUI, but I can not find this anywhere any more. Anyone know if such a link still exists in beta 5 or later?
BTW I know the simulated file system is now located in ~/Library/Developer/CoreSimulator/Devices/*/data/Containers/Data/Application/*/ (previously ~/Library/Application Support/iPhone Simulator/*/Applications/*/). I'm looking for a link directly from Xcode, e.g. on some Schemes page.
The location of the iOS 8 Simulator has changed from previous versions. Plus, every time you run the app from Xcode the location changes.
The easiest way to beta direct URL in Xcode is perhaps like this:
#if TARGET_IPHONE_SIMULATOR
// where are you?
NSLog(#"Documents Directory: %#", [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);
#endif
When you open a Finder window to that location and keep it open, it updates automatically to the new location when you run your app again.
Further reading: http://pinkstone.co.uk/where-is-the-documents-directory-for-the-ios-8-simulator/
As the previous answer explains the location changes all the time so it's not possible to have a link.
You can use the method above to print it to the console or save a small file upon start up that you can then search for.
Because I missed the convenience of the link I wrapped this into a small OS X app Simulator Data Finder and made it available. The website should be self explanatory how to use either for objective c or swift
As iam a newbie in iPhone app development, please help me with this issue.
According to my code, iam trying to create a folder called "New Folder" in the Documents. When i run this code, iam able to get the output in NSLog with the complete path and i can see where the folder is getting created in my system as well. But the problem is iam not able to see this folder in iPhone simulator. Is there any way to see this folder which i have created in simulator?
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSLog(#"%d",[paths count]);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *filePath = [NSString stringWithFormat:#"%#/New Folder", documentsDirectory];
NSLog(#"Path is: %#",filePath);
NSFileManager *manager = [NSFileManager defaultManager];
NSLog(#"%d",[manager createDirectoryAtPath:filePath withIntermediateDirectories:YES attributes:nil error:nil]);
NSLog(#"Folder created");
Yes you can see this folder by going through the following steps....
Open Your Finder Window. Go to Library -> Application Support -> iPhone Simulator -> Choose the type of Simulator(like 6.1, 5.0 etc) - > Applications -> Check the project of the simulator by its Name after going into the numbers -> Document.
This is your Document Directory. You will find your files here.
For more simplicity for viewing folders in document directory follow the steps:
1) NSLog the path and then copy it from console.
2) Open finder press Command+shift+g
3) Paste the path and press go.
You can see folder created manually by using following steps :
Go to Finder Window
Select Application Support
iPhone Simulator
Now, Select simulator version (say 6.1)
Applications (contains list of application that are executed)
Select your Application folder
Documents contains user created folders.
This is shown in screenshot