iCloud Drive take forever to upload. Is there a way to rush "Waiting to upload state"? - swift

I have two 50KB files saved in iCloud Drive. Using FileManager, saved in an iCloud container.
The problem is that they take forever to upload. I waited 2 hours and they are still in this waiting to upload status. Both my iPhone and iPad having this issue.
Is there a way I can force it upload? Or at least put it into priority queue.
I'm building a note app sync feature. And those slow upload makes sync impossible.

I ran into a problem like yours and tried to find the solution. So, I contacted directly to Apple Support.
Here's the suggestion:
First, you have to make sure that your OS version is up to date and your iCloud storage has enough space.
Next, you go to System Preference > Apple ID > uncheck a checkbox in front of iCloud then check it back.

Related

Delete local iCloud Data on Device (e.g. at first app launch/reinstallation)

If a user installs an an app which uses iCloud with a UI(Managed)Document, then uses the app, creates data which is saved to iCloud and then deletes the app on his phone, the iCloud data will stay on the device (transaction logs etc.). If the user reinstalls the app it will try to use these old files.
I have the following two problems with that:
The iCloud documents could have changed in the meanwhile and there might be problems when the user has no network connection on the first launch after reinstalling the app.
The iCloud documents for this app could have been deleted by the user (via settings or in Mac OS Finder in the user library). Now, when the user has no network on the first launch after reinstalling the app, the app might think that there is an ubiquity container with data even though it's already deleted (app might crash).
This is not very easy to test but I have definetely crashes and malfunctions for those two issues. E.g. NSMetadataQuery shows me results for documents which do not exist in iCloud because they have been deleted (but they existed on the deletion of the app).
Is there any easy solution to this? I thought about deleting the local iCloud data on the device when the app is launched for the first time - but how can this be done?
It can't be done. If you delete an iCloud document locally, you delete it everywhere-- eventually. The iCloud APIs have no concept of managing local copies independently of the iCloud service, so if you delete one-- even with the network down-- the iCloud ubiquity daemon will send a delete command to the service at the first opportunity.
The closest approximation that current APIs would allow would be:
Check whether the network is reachable
If it's not reachable, do not attempt to access any iCloud documents (because as you note, the information might be stale).
If and when the network comes up, try to open all existing iCloud documents. (On iOS, iCloud updates are only downloaded on demand, so you need to create that demand).
If that's not good enough (and let's face it, it's not good enough), file a bug with Apple and hope for the best.

Is there a way to completely disconnect an App from iCloud?

My App can work with or without iCloud support.
If a user connects a device to iCloud and then wants to disconnect it, it's pretty easy for me to copy all data back to the local sandbox and stop using iCloud, and this device won't contribute anything new to iCloud anymore. However, changes from other devices will still be received (although not handled) on this device.
Is there a way to completely disconnect the device from iCloud, so that new changes won't be received?
iCloud stores data in a folder called "Mobile Documents." Your app's container resides in this folder. iOS devices know about new files and changes immediately. However, they do not actually download the file until the app specifically requests it. Here's an example scenario:
Someone is running your app on their iPhone and their iPad. They use iCloud on both. However, on their iPhone they disable your app's iCloud but leave their iCloud account active. This means that their device always knows about changes. But since your app never requests those documents, they are never downloaded to the device and therefore do not take up space. Also, iOS will automatically remove the local copy of an iCloud file to free up space if necessary.
For more information, see developer.apple.com/icloud, specifically the videos on how to use iCloud.
You can simply stop responding to the NSNotifications received by your app. You can either unregister your views from these notifications, or ignore them when they're received.

How to pause/resume downloads in iPhone (iOS)

I have to download large amount of data (anywhere between 300MB - 1GB).
I am currently using **NSURLConnection**to download the data. But, now i am looking at a scenario where the user might loose the internet connection during the download process. Currently i am restarting the entire download process in this scenario, which i think is a very bad way of downloading and a waste of user bandwidth.
Is there a process in which i can manage the downloads with Pause/Resume functionality while downloading.
Here's a tutorial of how to do this on IOS.
Also check documentation. This will require your server to support range headers.
this needs synchronization both at server as well as client side. and i allready told u to use chunks. definetely chunks is the only solution if you want to pause. you will send the server with a chunk id to stop till this i'll get remaing next and next time you will ask from that id.
FIXED SOLUTION :
Fixed broken link and here is the working Tutorial to resume FIle Download file in iOS.
You can use "NSURLSession to pause and resume

What triggers iOS 5.0 cache purge?

As of iOS 5.0 Apple began to purge or clean the Caches directory inside individual applications when it decided the device was using too much space. Can anyone point me to the location of documentation or anecdotal information regarding at which threshold this cache cleaning occurs (for instance 90%+ disk usage) and how often it is checked?
From my my testing, it seems that the wipe happens to all not currently running applications when the space usage on the device EXCEEDS the reported amount of space available (seems iPhone lies about space available to prevent you from getting into reserved space). When you cross that line, a dialogue pops up:
And when you hit done, it then wipes the space. This is the only situation that I was able to reliably reproduce to trigger the wipe (for testing / etc), and I did so by filling my device as much as I could with movies and music, and then downloading big files in DropBox.
as far as i know there hasn't been any official information about when the purge happens and - to be honest - you shouldn't be trying to predict it. it IS a problem, though. thankfully, apple has realised this and as of iOS 5.0.1 you can set a "do not backup" flag:
http://developer.apple.com/library/ios/#qa/qa1719/_index.html
so you'll want to place those files in your app's Documents/ dir or your apps Library/Private Documents/ and set the "do not backup" attribute.

iPhone when does data get restored from backup

When does data get restored for an app? What if I save data in the app's document directory. Then they sync with iTunes. Now iTunes has a backup. Will that data be populated to another device when they sync that new device to their iTunes or will they just get a clean install of my app? I'm trying to figure out how to keep track of a subscription in app purchase and was wondering if I could keep record in NSUserDefaults or some other local store.
Backups are per-device. So a backup of your iPod will not be restored to your iPhone. In other words, there is no sync.
Many times iTunes fails to create complete backup of all the iPhone data say it be contacts, message, mails etc. This type of problem may occur due to not installing iTunes properly. So, you should check whether iTunes have been installed correctly or not. In case there is no problem with iTunes then it is possible that you are trying to create backup of the files which can not be backed with the help of iTunes. To overcome with this issue you need to make use of iPhone backup application. By using this tool you will be able to prepare backup of all the files within minutes safely.
If the user backs up to iTunes, and then restores their backup to another device (maybe they lost their original iPhone), the contents of the app Documents directory will be put on the new device. Anything in the tmp folder won't be backed up or restored like this, but the Documents folder will.
However, that's not the best way to store the in-app purchase information. You should be storing that on your own server and keeping a count of the number of times the purchased content has been used. Inform the user that they can use it a certain number of times (say three) and after that they will have to buy it again. I'm not exactly sure of any details beyond that (like how to verify their identity) but it should get you started.