Removing data from the cloud with fast

How to delete some data placed in the cloud? I made an application that when you enter the URL into 1 view controller, it uploads to the cloud, and when you switch to another view controller, it shows the URL that you entered earlier from the cloud in the web view. for example, when you log in to www.hello.com, it goes to the cloud, and when you go to web browsing on another controller, it downloads www.hello.com.

My problem:

When I enter the second URL, it still loads the first. How can I download the latest one I downloaded? Is there a way to remove the first when the second is loaded?

+4
source share
1 answer

You can delete entries with the code as follows:

database.deleteRecordWithID(CKRecordID(recordName: recordId), completionHandler: {recordID, error in 
 NSLog("OK or \(error)")
}

where the database is the CKDatabase that you are using.

But in your situation, it would be better to update the previous record created. Another solution would be to query your data when using the sort order for createDate as follows:

query.sortDescriptors = [NSSortDescriptor(key: "creationDate", ascending: false)]

Then just select the first one, since the last one you saved. A good addition is that you will have a history in your database.

+5
source

All Articles