When a new upgrade is released and installed on iOS, which folders / files are left untouched by the upgrade process? There are several folders; Library, Caches, Preferences, Documents.
Normally Application Support Directory is not created by default. What happen to AS folder during upgrade?
I learn that all data in Documents folder will copy to iTunes or iCloud by default. Is that true?
If I create my own CoreData db to persist, where should I keep?
Your best bet is to read the first half (which pertained to iOS) of this document from Apple:
In my experience, I put Core Data db in Documents folder if the iTunes File Sharing feature was not enabled on your app. Otherwise create a folder in the Library folder called Application Support or anything name, etc. With iTunes File Sharing enabled, user can accidentally delete any files in the Documents folder.
During the upgrade, the contents of Library and Documents folder are retained.
Related
I want to keep an apps documents directory that contains sqlite using core data files in sync across users' devices. The sqlite files are the only files in the apps documents directory and simply need to be common to all users' devices
I've tried zipping up the sqlite files to send by email, which works with iTunes file sharing but is not suitable for my needs as it can expose the files to other users' devices.
I've tried using app groups to keep the directory common across devices http://blog.sam-oakley.co.uk/post/92323630293/sharing-core-data-between-app-and-extension-in-ios,
and
Accessing Core Data SQL Database in iOS 8 Extension (Sharing Data Between App and Widget Extension) but that simply did not share the directory across devices for me.
I've sent the file to parse, but pulling them down and reconfiguring the data was the problem there.
I've tried using iCloud and even the Apple engineer gave up on that one.
What I'm after is the simplicity of file sharing through iTunes (being able to replace the sqlite files) with a bit more finesse and without the need to plug in the device.
Some considerations
The whole model can be synced in one go
Data does not need constant syncing facilities, a manual sync option would suffice.
We have stored our app sqlite database in the Library folder. We need that for future app upgrades from app store, the database included in the upgraded app to delete the database from the installed one when users download it from app store. We have checked from different sources, and they say that only the content in Documents folder will not be deleted.
Please can you confirm this point?
Thanks
The Library folder will survive an app upgrade. It's possible that Library/Caches will be deleted but not Library in general.
The simplest solution is to have the new version of your app use a different filename for the database file and have code that looks for and deletes the old database file.
I'm planning on having a generated file be stored in the App/Documents file for my app. I want this file to be unique across installations so that if a user has an iPad and an iPhone they will have two different versions of the file.
I've been reading the specification(https://developer.apple.com/library/ios/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/FileSystemOverview/FileSystemOverview.html) and am particularly concerned about this line.
Use this directory to store critical user documents and app data files. Critical data is any data that cannot be recreated by your app, such as user-generated content.
The contents of this directory can be made available to the user through file sharing. The contents of this directory are backed up by iTunes.
My question is will the files be backed up to the users account in the cloud?
yes it is. The Documents Directory is a key location in an app. which means that if you put anything in the documents, it will back up to itunes(if the user wants to). so even if you generated a unique file across installations, it will re-download the EXACT file to a new system if they downloaded it previously. so unique files in the DOCUMENTS will not be possible (unless a person uses a diffrent apple account on every one of his devices. which is not likely.)
I was under the impression that iCloud only worked with UIDocument files.
How about other types?
Also if my user's files get uploaded into the cloud, can he use those files with all his devices if my app is universal?
According to Apple's File System Programming Guide,
Handle support files—files your application downloads or generates and
can recreate as needed—in one of two ways:
In iOS 5.0 and earlier, put support files in the
/Library/Caches directory to prevent them from
being backed up
In iOS 5.0.1 and later, put support files in the
/Library/Application Support directory and apply
the com.apple.MobileBackup extended attribute to them. This
attribute prevents the files from being backed up to iTunes or
iCloud. If you have a large number of support files, you may store
them in a custom subdirectory and apply the extended attribute to
just the directory.
iCloud does back up of the things under Library also.
Ans YES of course if user's files get uploaded into the cloud, then he can use those files with all his devices if the app is universal as iCloud is intended to be the invisible magic that glues your iPhone, iPad and Mac (if you use one) together.
I have a phonegap iOS app using the sqlite DB of Webkit (through UIWebView), and I wonder if the sqlite data will be saved with iCloud Backup (iOS5). The sqlite data are stored in Library/WebKit folder. In the apple doc, they say:
The placement of files in your application’s home directory determines what gets backed up and what does not. Anything that would be backed up to a user’s computer is also backed up wirelessly to iCloud. Thus, everything in the Documents directory and most (but not all) of your application’s Library directory.
But it can say exactly which folder in the library directory are not saved. And I don't know how to access iCloud to check if the directory is saved
Library/WebKit is included in the backup. With the exception of Library/Caches, everything in the Library directory is backed up.
The data included in an iCloud backup for your app is identical to that included in an iTunes backup, so you can examine the contents by backing up to iTunes and using a tool like iPhone Backup Extractor to see what's included.