I have some problems because of iCloud and i want to turn off its for my app,how can i do it in the code of my application,i thought about my problem and the decision can be turning off the iCloud, thanks for help
If you store files in Documents, they will be backed up to iCloud automatically. If you don't want that, the easiest way is to just store them somewhere else. Library/Caches is a good choice. If you really MUST store in Documents but you want to disable iCloud backup you can use the technique outlined here:
https://developer.apple.com/library/ios/#qa/qa1719/_index.html
Related
Is there a way to make my Documents directory synchronized with iCloud?
I have setup all permissions and entitlements, but have no idea what to do next.
Could you please provide a swift code snippet or point into a direction I should look to?
You can use iCloud's CloudKit services for this.
Have a look at the Quick Start Guide for iCloud's Cloudkit here.
When I needed to keep NSUserDefaults in sync via iCloud in simple apps, I used: MKiCloudSync by Mugunth Kumar. While still Objective-C, it's pretty straightforward to use.
If you need iCloud Documents sync, you might check out iRareMedia/iCloudDocumentSync. Of course, this is a bit more work, but still easier than implementing all the methods by yourself.
Have a nice day,
#cdf1982
You can use iCloudDrive of iOS 8 to store documents in iCloud Drive..
Refer below links for iCloud set up for your app.
https://unionassets.com/iosnative/icloud-setup-25
http://www.raywenderlich.com/83116/beginning-cloudkit-tutorial
Refer below for saving document to iCloudDrive.
Save iOS 8 Documents to iCloud Drive
Refer below to view the documents which you have saved in iCloudDrive
https://github.com/iRareMedia/iCloudDocumentSync
Hope all the above links are useful to get the task done..!
The following 3 steps should get you going:
Step 1: Preparing the app to use iCloud Storage
Step 2: Learing to manage your files using the UIDocument Class
Step 3: Using iCloud Storage in your app
Cheers,
Istvan
I need to store files(text/pdf) to the device memory permanently. If I write to documents directory, my files get erased once my app is uninstalled. So I need an isolated directory, like the gallery. Can somebody help me with this?
Since Apps live in Sandboxes you can not store files outside the App´s Sandbox. You could use iCloud or another Backup System and from there the user could restore the files when the App was deleted.
As far as I know, you can't, and that is for a good reason. There would be no way for the user to control how much memory you are using, nor a way for them to free that memory. Your documents should be removed when the app is removed. If you need persistent storage, store it yourself, on a remote server; don't try to pollute the user's device.
You should take a look at the UIDocumentInteractionController
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIDocumentInteractionController_class/
As far as I know this is the only way.
I'd like to backup and restore files (or other type of informations like key-value, SQL-like transaction based info.) for NOT ONLY my app but also all the other Apps using iCloud.
I'm just new to iCloud and read only a few documents but it seems iCloud APIs are just for single App boundary (of course I understand there is an option for sharing information between 'Group' of applications).
What I want to do is backup and restore almost everything. How can I do that?
(There some apps doing this like
http://www.copytrans.net/copytranscontacts.php
http://www.macrumors.com/2012/05/18/elcomsofts-phone-forensics-software-offers-near-real-time-access-to-icloud-backups/)
I checked that the some of the Mobile App files are stored inside the "~/Library/Application\ Support/MobileSync/Backup" directory but there are only some of the files from all the files actually stored in iCloud.
And I tested CloudKit, but it just takes control over App's own data only.
Thanks in advance.
One thing to keep in mind when thinking about this is that iTunes actually doesn't backup or restore anything to/from iCloud. iOS device does it on its own: there's a daemon process running and if iCloud Backup is enabled, it will backup directly to iCloud, without talking to iTunes. Restore is also done without interaction with iTunes.
Next, as #rmaddy pointed out, your app on the device cannot access files of other apps, so you won't be able to do what you want from the device. If you want to do this via companion app running on PC/Mac then it might be possible, but will depend on what exactly do you need/want.
Re: contacts. Apps can access AddressBook and thus can sync/upload its contents. Apps can also access some other shared data, such as Photo Library. This is still a far cry from your original request to "Backup/Restore data for all Apps".
Re: downloading iCloud backups. Downloading isn't a big deal those days (Disclosure: I am the author of that forensic tool to download iCloud backups you're mentioned). There is even an open-source code for that. However, downloading and restoring are two very different processes. Specifically, you can download, but your app won't have enough permissions to write files in place.
Hope this helps and clears things up.
I'm developing an iOS app that has to support iOS 5+. I've read the iOS Data Storage Guidelines in order to prepare the app for the submission and read several questions and solutions about those guidelines here in Stackoverflow, but I still have some doubts about how I should handle this.
I have an sqlite database whose tables are defined in an .sqlite file. I copy this file into \Documents folder when app starts, and I keep such file always there in \Documents. This database firstly contains some collections of fixed data that app may need (lists of cities to select and things like that), and the rest is user-dependent data that will be downloaded. I've read this post: Apps must follow the iOS Data Storage Guidelines or they will be rejected in app that contains .sqlite3, but I still don't know what criteria should I apply. The .sqlite is not downloadable, it is included in Supported Files of the Xcode project, and some of the initial data is inserted from inside the app and it is neither downloadable. The user-dependent data, well, I can download it whenever I need. I've not integrated any iCloud stuff in my app. So, should it be correct to keep the .sqlite file always in Documents? AFAIK, you need the file to be there for performing all database operations...
As I said, I've not included any iCloud related code in my app, and in fact I don´t know how iCloud is managed because I've never told to do it, are backups of the app made anyway? Should I use the flags the iOS Data Storage Guidelines says in order to prevent files to be backuped? I need some guidence regarding backups and iCloud considerations.
And there is another thing: my app also downloads some user-dependent images. I show them in several views throughout the app, so I need them to persist while the normal working of the app. However, it is downloadable content. So, where should I place them?
Thanks a lot!
I believe your .sqlite file should be in Documents, this is the correct place for it.
You downloaded images should probably be in Caches, but you could also get away with them in documents as long as you set the "do not backup" attribute.
You can set the skip backup attribute like this:
BOOL success = [url setResourceValue: [NSNumber numberWithBool: skip]
forKey: NSURLIsExcludedFromBackupKey error: &error];
I was wondering if it was possible to use iCloud to sync an app's preferences file between devices. The preference file I am talking about is the com.domain.appname.plist file created by NSUserDafults to store the app's preferences.
I would like to have the option of keeping my app's preferences file in sync between two different devices (an iPad and an iPhone, for example). Is this an acceptable use of iCloud syncing? Or would I need to convert the plist file into a different type of document, store it on the cloud, and convert it back into the app's preferences file upon retrieving it?
thanks!
Similar to MKiCloudSync, I also have a library on GitHub called SDCloudDefaults. Rather than sync automatically, there's a new object that you use instead of NSUserDefaults that saves to both iCloud and NSUserDefaults. This means you can decide which elements are stored locally and which are stored in the cloud.
(I found MKiCloudSync after I'd implemented it. I think it's clever but I don't want to sync everything to iCloud so my solution still works better for me.)
There is a library available to do this with one line of code
https://github.com/MugunthKumar/MKiCloudSync
It is possible to sync preferences between devices using iCloud. However, I would recommend against sharing the plist file between devices.
The NSUbiquitousKeyValueStore should be suitable for what you trying to do. It is very similar to NSUserDefaults, so it should be easy to pick up.
To use it, simply enable the com.apple.developer.ubiquity-kvstore-identifier entitlement in your entitlements file and just duplicate the preferences you like to sync in the ubiquitous key value store. Once it's in the ubiquitous kvstore, you'll be able to see it from the application on other devices. You can even sync between different applications as long as they use the same identifier.
You should also register for the NSUbiquitousKeyValueStoreDidChangeExternallyNotification notification to watch for new changes and update the standardUserDefaults on the device accordingly.