physical path for application documents directory - iphone

what is the physical path of any application's document directory ? (on Mac OS X Lion)
I know that there is UUID for each app on that folder but could not find it on my system until now

Open
/Users/UserName/Library/Application Support/iPhone
Simulator/4.3.2/Applications
Assuming 4.3.2 is the sdk version being used. Note that there's a Library folder inside MacintoshHD too, but you have to goto the one inside the current user's home directory. Also in Lion the user's Library folder is hidden by default. You'd need to click on Go on menu bar, holding the option key, to see it.

In Ios 5 this path has change it is as below
find this from GO menu of finder and find with Goto Folder and past this link
/Users/admin/Library/Application Support/iPhone Simulator

/Users/System Name/Library/Application Support/iPhone Simulator/4.3(target)/Applications
here you will see a bunch of folders for each application.Better rearrange them by date.Find yar application's folder inside that.And you will get your application document directory there.

Related

How to download app data in Xcode 4.2

In the latest version of Xcode I could simply go to Organizer->MyDevice->Applications and then select the app I wanted to look at and download the appdata in form of a folder with all the app content. Now I only get a .xcappdata file.
How can I access this file for take a look in a .sqlite file?
Under the Data files in Sandbox pane in the Organizer, you'll find all the individual files that the selected app stores on the device and uses, displayed in a hierarchical view.
For my app, it looks like this:
To view the files in Finder, download the .xcappdata file, go to where you save it in Finder, Control-click on it and choose Show Package Contents. The directory structure is identical to what you see in the Organizer, and you can open and/or copy out the files as usual.
I'm constantly checking my app's database, so to speed things up I always download the .xcappdata to the same folder. I then run the following script that's sitting in that folder to look at the latest version of the database in 'sqliteman' (a sqlite program available through MacPorts):
#!/bin/bash
shopt - nullglob
for PACKAGE in *.xcappdata; do
CURRENT=$PACKAGE
done
sqliteman "$CURRENT/AppData/Documents/yourapphere.sqlite"

iPhone application, Documents directory on Mac

I'm reading through some of the documentation about File Management on iOS. When you create an application for the simulator, does the application get created somewhere on my hard drive? If so, where is it?
Also, does this have access to the Documents directory? Like if I create some test .txt file, and want to see it in the App->Documents folder, is that possible? Thanks.
Yes. Look here:
~/Library/Application Support/iPhone Simulator/4.3.2/Applications
Change the 4.3.2 to be the version of the Simulator you are using.
Within that folder you will find your apps, except the they are named cryptically. Open one of those folders and you will find your app, named as you recognize it, and the Documents, Library and tmp folders. Documents is where you find the docs that your app creates and uses. You can, in fact, makes changes to the files in the Documents folder or just access their content to see what your app sees or writes.
Under XCode 6, the document directory for your app is quite hidden:
~/Library/Developer/CoreSimulator/Devices//data/Containers/Data/Application//
You can find the directory for your app with this command:
$ sudo find ~/Library/Developer/CoreSimulator/Devices -name <APP_NAME>.app | grep -o '.*/'

iPhone simulator folder not in Application Support

I am creating an application that write some data to the database. For checking I need to open the database in applications.
I think it should be in
~/Library/Application Support/iphone simulator....
I have not found the iphone simulator folder in Application Support.I have installed ios 4.2, and simulator is working properly.
Where can I find it?
Xcode versions 3.x-5.x
Simulator usually is installed together with SDK so most probably you should look (e.g., if you installed Xcode 3.1 and SDK 4.3 in their default locations) within:
/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iOS Simulator.app
Apps that are installed on your iPhone Simulator should be (if for example compiled for iOS 4.3) located in:
~/Library/Application Support/iPhone Simulator/4.3/Applications/[app GUID]
If you are looking for .sqlite database within Application, it should reside in:
~/Library/Application Support/iPhone Simulator/4.3/Applications/[app GUID]/Documents/[appname].sqlite
Xcode 6
The simulator devices are located in:
~/Library/Developer/CoreSimulator/Devices/
so your application data (e.g. application database in app Document folder) will be in
~/Library/Developer/CoreSimulator/Devices/[simulator device id]/data/Applications/[app GUID]/Documents/[appname.sqlite]
On Mac OS X 10.7 the users/[username]/Library is hidden. Reveal it using:
chflags nohidden ~/Library
In IOS5, follow this step
Right Click finder in Dock.
Click 'Go to Folder'.
Give folder name as "/Users/'USER NAME'/Library/Application Support/iPhone Simulator/"
It will take you there.
NOTE: When you run the simulator, it creates a directory under your home directory located at:
~/Library/Application Support/iPhone Simulator/
When you install an application onto the simulator, it creates a sandbox for the application in a path that looks something like this:
~/Library/Application Support/iPhone Simulator/user/Applications/<GUID>
Where <GUID> is a directory with the name being a GUID assigned to the application during the installation process. The GUID isn’t particularly necessary to find for you application, and the path to your application’s sandbox can be found with a quick display of command-line foo. From the ~/Library/Application Support, run:
Deminem$ find ./ -name "AppName.app"
And, voila. It will return a list of all the sandbox directories which contains this application. The "private" data for your app inside the directory:
~/Library/Application Support/iPhone Simulator/user/Applications/<GUID>/Documents
Good luck! ;)
Now on ios 8 the application data is located at Library/Developer/CoreSimulator/Devices/DEVICE NUMBER/data/Containers/Data/Application/APPLICATION ID
On XCode 8. the sqlite file is in
~/Library/Developer/CoreSimulator/Devices/[DEVICE ID ]/data/Containers/Data/Application/B4813EE5-CC8E-4728-872E-41918AD1C14D/Documents/[APPLICATION NAME].sqlite
I don't know the mean by "B4813EE5-CC8E-4728-872E-41918AD1C14D".
The way to get DEVICE ID:
Click to dropdown the simulators list
Click "Add Additional Simulators..."
Select the simulator you are using
We are now up to simulator 5.0 and iOS 6 is in beta 4 stage. All previous answers and comments are out of date.
I would suggest testing with
ls -la ~/Library/Application\ Support/iPhone\ Simulator/*.*/Applications
To answer the specific question about databases
find ~/Library/Application\ Support/iPhone\ Simulator/*.*/Applications -name \*.sqlite
That should last until Apple makes a drastic change.
It sounds like you're talking about the SQLite file used by Core Data – if so, that file should be in ~Library/Application Support/iPhone Simulator/4.2/Applications/[AppID]/Library/ (assuming you're simulating iOS 4.2). If it's not there, I'm not sure where else it would be.
You can find it here
/Users/YOURUSER/Library/Application Support/iPhone Simulator/5.1/Applications
or
/Users/YOURUSER/Library/Application Support/iPhone Simulator/6.0/Applications
You can also write two lines of code that will tell you exactly where your app is located.
NSString *appFolderPath = [[NSBundle mainBundle] resourcePath];
NSLog(#"%#", appFolderPath);
In iOS 10, Xcode 8.3.3,
Find the Document path from
NSSearchPathForDirectoriesInDomains(FileManager.SearchPathDirectory.documentDirectory, FileManager.SearchPathDomainMask.userDomainMask, true)
then you can find the sqlite file in path printed

Viewing SQLite3 Database (XCODE)

I am creating an iphone app within XCODE the makes use of an SQLite3 database. I am creating the database programmatically if it does not exist. I am not getting any errors when I run the program.
How can I check the contents of the database to ensure that the data has been inserted correctly into the correct columns? Where does Xcode place the table within my system where I can view it?
The SQLite database will be created in your apps Documents folder, in the simulator's base directory.
Before Xcode 6, you can check in:
~/Library/Application Support/iPhone Simulator/4.2/Applications/GUID/Documents
There is also a Mac OS X application called SQLiteBrowser that you can use to browse the database your app created.
Update :
As of Xcode 6, the new iOS simulator's directory is located here :
~/Library/Developer/CoreSimulator
Ultimately, you can find your app's database under a location like this (Replace UIDs by yours) :
~/Library/Developer/CoreSimulator/Devices/4D2D127A-7103-41B2-872B-2DB891B978A2/data/Containers/Data/Application/0323215C-2B91-47F7-BE81-EB24B4DA7339/Documents/MyApp.sqlite
Source: SO: Xcode 6 iPhone Simulator Application Support Location
If you want to view the database that you are created,
Open finder press Command+g "~/Library/Application Support/iPhone Simulator" then go.
Open 5.0 (as per your version of simulator)-> Application-> select the pgm folder
-> Documents
Then you can see the database
Xcode 9.1:
Open Terminal, type:
cd ~ & find -name "YourModelName.sqlite"
You'll most likely be presented with such a path:
~/Library/Developer/CoreSimulator/Devices/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/data/Containers/Data/Application/YYYYYYYY-YYYY-YYYY-YYYY-YYYYYYYYYYYY/Library/Application
Support/
Open Finder, press Shift + Command + G, paste the path and press Go.
Use DB Browser for SQLite to view the .sqlite file.
There are a bunch of standalone programs that look at sqllite files. A very popular one for the Mac is called "Base":
http://itunes.apple.com/us/app/base/id402383384?mt=12
The simulator directory has been moved with Xcode 6 to: ~/Library/Developer/CoreSimulator. To find the unique path add the following statement to the AppDelegate.m file, applicationDocumentsDirectory method:
NSLog(#"%#",[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]);

Xcode won't let go a resource file

My question today is about how Xcode deals with resource files in the app bundle which it creates. I know that it may be trivial, but I can't find an easy way out.
Basically my problem is that Xcode seems to keep on including a resource file (eg a text file) in the app bundle even if the file has been removed from the project.
Here it is in detail what is happening here.
⁃ Added a file to the project (both by choosing file - new file or dragging a file to the Xcode groups and files left column checking add to project folder if needed checkbox)
⁃ Compiled and launched the project in simulator
⁃ Verified that the file is present in myApp.app bundle, located in User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even in <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app
⁃ Deleted the file from groups and files column in Xcode
⁃ Deleted the actual file with Finder in <my Xcode projects folder>/myApp/myFile
⁃ Deleted User/Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app and even <my Xcode projects folder>/myApp/build/debugiPhonesimulator/myApp.app
⁃ Emptied the trash
⁃ Verified that there is no reference to the file with Finder spotlight
⁃ Verified that there is no reference to the file with Xcode search
⁃ Rebuilt and relaunched the app in simulator
⁃ Verified that a brand new /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app has been just created
⁃ Verified the content of /Library/Application/Support/iPhone Simulator/3.2/Applications/<application system number>/myApp.app bundle: the file is still there. Where the h. did Xcode take it from?
I am surely missing something really obvious. Any help?
Have you checked the "Targets" node ? If not then;
Expand the "Targets" node and the application one.
There must be a build phase called "Copy Bundle Resources".
Check that the resource is not in the phase.
You can also try to perform a full clean of the project to ensure that no temporary files stay.
Clean used to work in xcode 3 but it doesn't seem to do a thing in 4. I found that deleting the app from the test device seems to help make the resource disappear.
Ran into a similar problem a few days ago.
It turned out that under 3.2, the simulator creates several application folders, one for each SDK version installed. I have:
~/Library/Application Support/iPhone Simulator/3.0
~/Library/Application Support/iPhone Simulator/3.1.2
~/Library/Application Support/iPhone Simulator/3.1.3
~/Library/Application Support/iPhone Simulator/3.2
~/Library/Application Support/iPhone Simulator/User
If you compile under a different SDK it creates a new application directory for the app within the folder for the new SDK. I had an alias to the old folder and ended up looking in the wrong folder at a version of the app that Xcode was no longer targeting and therefore never changing. IIRC, I had to track down the new app in the matching SDK folder.
I had the same problem. However the solution proposed in the answer, didn't solve my problem.
In the Targets > Copy Bundle Resources, I don't see the "ghost" files.
I tried doing a full clean up, delete the app and reinstall it, and I still have the files in my app.
The solution I found was by manually deleting the contents of the folder: ~/Library/Application\ Support/iPhone\ Simulator/4.3/Applications/
Remove the app from the simulator and delete with finder the directory of your app in Library > Developer > Xcode > DerivedData.
I ran into a similar problem. Xcode 4 keeps complaining about missing resource file even though it has been removed from the project. It results in build error.
This is how it's resolved:
1) Open the .pbxproj file
2) Delete all the lines referencing the resource file that you want to get rid of
3) Build it
I had a similar problem with a .scnassets file - XCode Copy Resources only lists the .scnassets file (a real folder, not a group) but also remembers and copies it's contents even if they've been deleted. An intentional clean fixes this. Moreover, files deleted from a ghost .scnassets files appear to be copied every time you run the app, instead of the first time they're needed. Cleaning speed my build time up by 300%!