In this video, learn all about the basics of saving your data to CloudKit using the convenience API.
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4247-beginning-cloudkit/lessons/4
In this video, learn all about the basics of saving your data to CloudKit using the convenience API.
Hi Brian,
A quick question: What are the advantages of using enums vs. using structs for your constants?
@vegetarianzombie Do you have any feedback on this one? Thank you - much appreciated! :]
Hi Zombie,
No answer yet from Bryan.
Both are umbrellas, both provide type and both help keep your code structured.
But my take on this is that from a semantic point of view , I"ll go for enums.
(It is now the Ray Wenderlich recommended way)
Also using a caseless enum prevents you from creating an instance of that type.
Hey @vegetarianzombie - First, love the tutorials, been extremely helpful. You mention in Saving Data that you will cover modifying a RecordType. Iāve watched a couple of times and canāt find it. Iām using private data to hold a few fields for consistency across devices - I can save the initial values, query them, but canāt figure out how to modify and save. So I have the CRD part of CRUD, looking for the U. Thanks in advance.
Al
Thank you for great tutorial. My question is, how can I save an array of objects, entriesArray in my example :
class FS_Statement
{
ā¦
var entriesArray: [FS_Entry] = [ ] //how to save this array?
}
class FS_Entry
{
var amount: FS_Amount? //or how would I save this object?
ā¦
var subEntryArray: [FS_Entry] = [ ]
var type: FinancialEntryType = .parentEntry
}
class FS_Amount {
var _abs_value: Double?
var _isIncome: Bool?
}
In Firebase I just made a json dictionary of type AnyObject, but CloudKit doesnāt support it
Hi Brian,
Thank you very much for the great tutorial!
I have a question, Could you please say, can user delete saved data from CloudKit? I tried to delete data from settings, [Settings] ā [iCloud] ā [Manage Storage], but there is not my app in the āManage storageā list. Also it happened with Key-value storage. Must I do it only programmatically?
I donāt believe userās have the ability to granularly delete data from cloudkit databases. Iām pretty sure the only option is to opt-out or programmatically delete the info.
Hey Brian,
can you explain what happens when the app is closed while records are being saved?
How can I guarantee that the update was successful?
I ask because when I want to save a new value on a record and the internet connection is poor at this moment, the upload might take some time. During this time the user closes the app. What happens then? (it is all asynchronous)
My idea to guarantee it is to store a āsuccessfullySavedā variable that indicates whether the update was successful. I would set it to TRUE in the completion block of the saveRecord function. When the app enters the foreground again, I can check whether there are still updates pending.
Another solution would be long-lived operations. But in my opinion it is a overkill for uploading just one āsmallā value.
Itās been a long time since I worked with CloudKit. I never did tests to perform a query in the face of app shutdown. If the query is mission critical, then you should have your app perform some background processing. I hope that helps.
Thanks for you reply! Yes I think you are right. it is the best to perform background tasks when working with cloud kit.
Just a quick bit of feedback. It is super confusing that Brian instructs us to use the AttendeeTableViewController
, which is a class in the demo project, but itās not in the Starter project.
It might be really helpful to just overdub this lesson and correct him to say āSessionTableViewControllerā instead of āAttendeeTableViewControllerā. Just sayinā.
When I get to the challenge, I pause the video. However, itās only until you get to the solution part of the video does it become clear that at some point the challenge uses SessionTableViewController
, not AttendeeTableViewController
.
Itās a minor thing, but itās just a little frustrating ā and it held me up a bit, when Iām trying to go through these tutorials as quickly as possibleā¦
@bdmoakley Can you please help with this when you get a chance? Thank you - much appreciated! :]
Thanks for letting us know. Sometimes these things occur, especially when we do a refactor of an older project. Nice work making it through.
@vegetarianzombie The download materials donāt match what is in the videos.
This are some of the files are missing:
AttendeeTableViewController.swift
plist files
Can you please let me know here can I download the files are missing?