Will sqlite database be port over to iTunes when iphone app got sync - iphone

I was wondering whether my app's sqlite database will be transfer over to desktop when user sync the app with iTunes or do I need to do some coding to ensure that it will be transferred?
Please advice. Many thanks.

You can transfer the content of your document directory's document folder contents by adding UIFileSharingEnabled key to your info.plist.
Please check the below image:
After adding this key to your info.plist, when you sync your iPad with iTunes the documents inside the document folder will be listed in iTunes as shown below:
This is a nice tutorial for starting the iTunes filesharing: How to integrate iTunes file sharing

We not only can backup our files on itunes but also in icloud....
this is how the app data is persisted along the the app updation ,ios upgradation....

As you long you put your data files in standard locations within the app's sandbox and you don't explicitly flag the file as a file that shouldn't be backed up, then the data files will be backed up to iCloud or iTunes (depending on how the user has setup device backups).

It depends on your file scheme, you can decide which information is necessary and should be backed up and which one should not because it can be easily recreated.
Look for the "Where You Should Put Your App’s Files" section
http://developer.apple.com/library/ios/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/FileSystemOverview/FileSystemOverview.html#//apple_ref/doc/uid/TP40010672-CH2-SW2

Related

How Can I Setup My iOS App To Use Automatic iCloud Backup?

I have written an app the uses the RealmDB, which produces a file called default.realm. This is the database storage file. I would like to setup my app to make use of the iCloud automatic backup feature. How can I setup my app to do this?
You can't! Because your app is already set up like that! :)
According to the File System Basics page on Apple's website, all files in an app's Documents folder will automatically be backed up to iCloud, or the user's local iTunes account if they've chosen such. This is on by default, and must be explicitly disabled through code if disabling backup is desired.
By default, Realm places default.realm in the Documents directory for this exact reason: to ensure any user-generated data stored in it will be properly backed up in through iCloud and/or iTunes sync operations.
So you don't need to worry! Your Realm data is already being properly backed up by iCloud as we speak! :)

Apps must follow the iOS Data Storage Guidelines or they will be rejected in app that contains .sqlite3

I created an ebook app and my app contains a lot of images and pdf files
I was putting the downloaded images in /Library/Caches and putting the pdf files and .sqlite3 file in /Documents
now my app is rejected and this is the reason
2.23 Apps must follow the iOS Data Storage Guidelines or they will be rejected
Is this means that I have to move all what in /Documents to /Library/Caches?
If I let the .sqlite3 file in /Documents, will the app reject again?
Thanks in advance.
2.23 means that you should only put stuff into /Documents that cannot be re-downloaded from the internet. i.e. user-generated files. Everything that CAN be re-downloaded should be in Library/Caches.
The reason for this rule is that /Documents gets backed up and users don't like if you waste their precious iClould backup space.
You don't necessarily have to put the downloaded PDFs and databases into the Caches directory. An alternative would be to use the "do not backup" attribute, as described here: Technical Q&A QA1719 - How do I prevent files from being backed up to iCloud and iTunes?.

Iphone app to be used like usb storage.

I'm wanting to access applications storage via iTunes, where i can save documents and be available in my app.
I have looked all over google, but without a specific name i don't know what I'm looking for.
Some of the app's that use this functionality are VLC & usb Disk; there are many many more.
So I'm asking what the API is called and if anyone knows of sample code or an example.
Essentially, all you have to do is add a boolean UIFileSharingEnabled (YES) key to your app's info.plist. Then the documents added through iTunes will be available in your app's documents directory.
UIFileSharingEnabled (Boolean - iOS) specifies whether the application
shares files through iTunes. If this key is YES, the application
shares files. If it is not present or is NO, the application does not
share files. Applications must put any files they want to share with
the user in their /Documents directory, where
is the path to the application’s home directory.
In iTunes, the user can access an application’s shared files from the
File Sharing section of the Apps tab for the selected device. From
this tab, users can add and remove files from the directory.
This key is supported in iOS 3.2 and later.
Apple's sample code: DocInteraction

iphone transferring files using iTunes, but not allowing user to see all of docs directory?

It doesn't sound like this is possible, but I will ask anyway.
In my app, I store a lot of images and plists in the documents directory.
I would like to implement a PDF reader in the app that allows users to load their PDFs into the app via iTunes. I do not want the user to be able to see/access the contents of the documents directory since they could cause the app to perform unexpectedly if they messed with these files.
Is this possible, or is it possible to place my plists and images somewhere else?
You'll need to be registered with Apple to see this, but this page should give you the information you need.
You'll need to add a UIFileSharingEnabled key to Info.plist. This will give the user access to the Documents directory of the app, and let them remove or add files.
This tutorial gives an example of how to set up PDF support in an iPad app.

How to retrive Core Data SQL store from Developer's App on the Developer's iPhone

I need a copy of the store that is saved as Core Data sqlite file inside a test app installed on my device.
I know how to get files out of the the simulator at path: ~/Library/Application Support/iPhone Simulator/[Version]/Applications/[AppID]/Documents
...but i need get the .sqlite file from the app on the device itself.
Unless the app itself has file sharing built in, you can't access the documents folder from outside the app. It is a security precaution and part of the sandbox.
Update:
I misunderstood the context of the question. To get files off a developers iPhone, connect the device and open Xcode>Window>Organizer. Select the device in the lefthand pane. In the righthand pane will be a list of applications. Your custom apps will have an arrow next to it. Hit the arrow and you will see "Application Data" hit the down arrow icon and it will let you download the data to folder. That folder will contain the apps Document, Library and tmp folders.
I wrote an application specifically for this to distribute to my customers and testers of my applications when they have problems. iPhoneRescue is free and allows you to get at all of the backup information in your iPhone; this includes any sqlite files.
All the users have to do is find their device backup, find the application, and then save the application files or just a specific file. (This does not work if they have encrypted their backups).