Closed BlixLT closed 4 years ago
My intitial thought, that something like func uploadRecords(adapter: ModelAdapter, completion: @escaping (Error?)->())
could be reused (both methods are dealing with uploading CKRecords). However, it fetches records to upload inside, so not sure how easily refactor it.
Just to clarify:
My intitial thought, that something like func uploadRecords(adapter: ModelAdapter, completion: @escaping (Error?)->()) could be reused
As you said the use case would be to set the right parent-child hierarchy for records that were created before the library supported CKRecord.parent
, to support sharing.
If your model classes were conforming to the ParentKey
protocol already you wouldn't have any use for this method.
If you had used SyncKit some time ago, before CKSharing
was supported, and created several records with it, and now you wanted to be able to share some of them, then you might want the .parent
property for those records would to be updated before you share the parent record, so the whole record tree is visible by the user accepting the share. In such a case this method might be helpful.
Will add error handling when I get a chance.
0.7.9
now uses batch uploads for this function.
reuploadRecordsForChildrenOf
should handle errors. At least one easy reproducible issue is with limitExceeded error (when records "tree" contains more than 400 objects). ThenreuploadRecordsForChildrenOf
gets a limitExceededError and future operations fails. To reproduce you can create a company with 400+ employees in the sample app and try to share that company. One more change in the sample project's sharing method is needed:I couldn't find the usage of this method in the sample project, but I suppose something like that is supposed usage - to make sure, that records "tree" has correct children-parent relationships, re-upload them before sharing.