cloudkit

CKReference .DeleteSelf attribute has no effect

冷暖自知 提交于 2019-12-05 08:20:10
How does .DeleteSelf really work? Docs says: When the reference object’s action is set to CKReferenceActionDeleteSelf, the target of the reference—that is, the record stored in the reference’s recordID property—becomes the owner of the source record. Deleting the target (owner) record deletes all its source records. but my impression is that deleting a target will not always delete source. And it is quite annoying when it remains in the container, client downloads it, and expect that the reference point to somewhere, but target does not exist when building up slice of the server data store on

(iOS 10, Swift 3) Reading `userInfo` dictionary from a CloudKit notification: How do I cast `[AnyHashable : Any]` to `[String : NSObject]`?

跟風遠走 提交于 2019-12-05 07:48:18
Background I'm trying to load the userInfo dictionary from application:didReceiveRemoteNotification:userInfo:fetchCompletionHandler in my app delegate. I then need to cast userInfo from [AnyHashable:Any] to [String:NSObject] so I can use it in CloudKit's CKNotification:fromRemoteNotificationDictionary . Question When I do: let ui = userInfo as! [String : NSObject] I get the error: '[AnyHashable:Any]' is not convertible to '[String:NSObject]' Is there a better way to convert userInfo to the appropriate type, or am I on a completely wrong track? You just need to cast it first to NSDictionary and

CloudKit - How to share multiple records and retrieve shared records?

送分小仙女□ 提交于 2019-12-05 07:34:15
问题 I watched last WWDC 2016 What's New with CloudKit to understand how to share records with other users using CKShare Single record sharing: I am able to share and retrieve a single record i.e if xyz@gmail.com has created and shared a single record to abc@gmail.com Multiple records sharing: let's say there are 10 records and xyz@gmail.com wants to share to abc@gmail.com . I am facing the issue when user xyz@gmail.com shares multiple records to user abc@gmail.com What I have tried so far: First

CloudKit Delete Self option for CKReference Doesn't work

最后都变了- 提交于 2019-12-05 06:30:34
Does anybody have experience using the CloudKit option to DeleteSelf for a CKReference ? Here is what I got from the docs: DeleteSelf The delete action for referenced records. Deleting a record also deletes any records containing CKReference objects that point to that record. The deletion of the additional records may trigger a cascade deletion of more records. The deletions are asynchronous in the default zone and immediate in a custom zone. So I've been testing this out, I have created multiple CKReference objects both using the CloudKit Dashboard and by using my app. Whenever I do it with

CloudKit Sharing

孤街醉人 提交于 2019-12-05 04:35:55
问题 I am having trouble understanding some of the CloudKit sharing concepts and the WWDC 2016 "What's new in CloudKit" video doesn't appear to explain everything that is required to allow users to share and access shared records. I have successfully created an app that allows the user to create and edit a record in their private database. I have also been able to create a Share record and share this using the provided sharing UIController. This can be successfully received and accepted by the

CloudKit error handling - retry logic

穿精又带淫゛_ 提交于 2019-12-05 02:43:32
问题 I want to put excellent CloudKit error handling in my app as Apple wants us to do. I want to save and modify a record right now. Here is my basic save logic... func addNewRecord(managedObj: NSManagedObject) { let newRec = managedObj.convertToCkRecord() publicDB.saveRecord(newRec, completionHandler: saveHandler) } func saveHandler(savedRecord: CKRecord?, error: NSError?) { // handle errors here if let error = error { if error.code == CKErrorCode.NotAuthenticated.rawValue { // debug print("Not

CloudKit CKQueryOperation doesn't get all records

白昼怎懂夜的黑 提交于 2019-12-05 02:34:09
问题 In CloudKit RecordType is more than 100 records. Following code gets from these only 11 and they are not first 11 records, they are picked randomly from beginning, center and at the end of records. I can't get whats wrong in code. EDIT : I got it working by changing .reseltsLimit to 5000! let cloudContainer = CKContainer.default() let publicDatabase = cloudContainer.publicCloudDatabase let predicate = NSPredicate(value: true) let query = CKQuery(recordType: "Sijainti", predicate: predicate)

Authorization error on call to server-to-server CloudKit Web Services

吃可爱长大的小学妹 提交于 2019-12-05 02:06:27
问题 I'm attempting to implement some basic integration with CloudKit web services, following Apple's guide for authenticating requests. I've followed some help from this and this question as to how to properly authorize requests, and seem to be following all steps correctly, but I'm still getting a 401 AUTHENTICATION_FAILED error from Apple. The endpoint I'm targeting is a POST endpoint for retrieving a record, given a record name. I've added comments to my code to show the outputs i get at

CKAsset won't show in tableview image

北城以北 提交于 2019-12-05 01:57:59
问题 I have an optional image in the cloudkit DB(checked DB and the image is there in cases where I added it in my testing). I have created a class that initializes the record fields into variables I use in my tableview. I have a custom cell as well. But the image won't display in my custom tableview cell. I don't know if having an optional image in a tableview image is causing a problem or if there's an issue with my code/settings in cloudkit. Any help is greatly appreciated, as I've been stuck

CloudKit fetchRecordChangesOperation gives a “AppDefaultZone does not support sync semantics”

核能气质少年 提交于 2019-12-05 01:48:40
I'm using a CKFetchRecordChangesOperation with a CKFetchRecordsChangeToken to grab changes and it is telling me that the "AppDefaultZone does not support sync semantics". Here is the offending code: - (void)downloadServerChangesWithCompletionBlock:(void (^)(NSError *error))completionBlock { // Prepare to fetch remote changes CKDatabase *database = [CKContainer defaultContainer].privateCloudDatabase; CKRecordZoneID *zoneID = [[CKRecordZoneID alloc] initWithZoneName:CKRecordZoneDefaultName ownerName:CKOwnerDefaultName]; // Initialize fetch record changes operation CKFetchRecordChangesOperation