File in documents Directory after deletion - iphone

I created an sqlite file[or any file] in documents directory in ios device.If i removed the app (delete) from the device this file stays or get removed?

The sandbox of an application deletes automatically when you delete the app. It happens in both your device and in iOS simulator.

Documents directory allows you to store files and subdirectories your app creates or may need, for example a database.
Your application works in a sandbox environment. When you delete the application in simulator or device, the directory that was created by application is deleted and so do the files residing in it.
When you reset your simulator you can find the deleted files in the trash.

Related

Database path not been used by application - Logic issue

I have created a sqlite database. and dragged it on to my projects resource folder.
In my project i am accessing a sqlite file from
/Users/user12/Library/Application Support/iPhone Simulator/4.3.2/Applications/1F219005-A4ED-4794-81FC-65EEF8D243EF/Documents/db.sqlite
I am not using the sqlite file that was added to the project. and my project is accessing the DB file from the above location.
So, now when i try to launch my application from a different mac i am unable to launch the application because the DB is not found in that path. So how could i solve this ?
note: i used FMDB.
My final objective is to give this application to my client and since he will be running the app on his iPhone, he should be able to access the sqlite file with no issue. So what changes should i make ?
Surely xcode in other machine will have a different path. Try to place the sqlite file at the app path created by xcode on the new machine.
EDIT:
To do what you've said in your comment i suggest to create an ad-hoc certificate. Then use xcode to create your archive.
But the path of your sqlite file should be in your main bundle.
ps: You need the UDIDs of your client iPhones to add the devices to the portal.

Looking into app folders during iPhone development

My app creates folders on the iPhone, stuffs files into them, moves them around, and so on. I'm trying to debug some hiccups in this behavior, but am finding it hard to see what's actually going on with the files and folders. Is there a way I can look into the folder hierarchy of the iPhone simulator or of a dev-tethered iPhone at all like I could with Finder or a command prompt on my mac?
Yes, the files will be in the simulator's workspace. They're located at the following path:
~/Library/Application Support/iPhone Simulator/<version>/Applications/<uuid>/
For version, choose the version number of the iOS version you installed your app to in the simulator (e.g., 4.2). When your app is installed in the simulator, each app is given some GUID, so look in each of these until you find the app you're testing. Under that directory will be what your app sandbox will look like on the phone. You can see all the files that your app created in the simulator there, and you can watch them in Finder or whatever you'd like.
Be aware, however, that each time you hit the 'Build and Run' command targeting the simulator, a new GUID will be generated and your app will be relocated to that directory. This is similar to what happens when the user updates your app on the phone.

Where are the cache files of NSFetchedResultsController located?

I am trying to see if cache files are successfully created but can't find their location on the disk (neither on simulator nor iPhone device)
Any ideas?
They are located in
${APP_DIRECTORY}/Library/Caches/.CoreDataCaches

Can you pre-populate an iPhone Apps Caches or Document Directory with data in XCode?

I have an iPhone application that downloads images into the Caches directory on an as needed basis. However, I'd like to provide a portion of those images pre-cached. Is there a way through XCode to define a "Library/Caches" folder that will copy into the Library/Caches folder found in The Application home directory on the iPhone - so I can build them in at build time? Or do I need to put them in as a resource, and then have my app copy them to the Cache on start?
You'll need to copy them from your app bundle to the caches on first run startup.

Prevent access of documents directory in organizer of iphone application

From organizer window i can copy document directory data. But in some apps i noticed that
it is locked and cant access documents directory.How can i lock the application from accessing
documents directory via organizer.
I suppose you can access documents directory of applications that are signed with provisioning profile installed on your computer. Imo it is a handy feature for developer purposes. However it is disabled for applications downloaded from appstore so why should you worry about it?