cloudkit

How to Be Notified if the Owner Removes Me from a CKShare on CloudKit

跟風遠走 提交于 2019-12-10 11:31:23
问题 Let's say the owner of a record shares it with me. I get sent a share link and I open it and accept the share like this: let operation = CKAcceptSharesOperation(shareMetadatas: [metadata]) operation.acceptSharesCompletionBlock = { error in if let error = error{ print("accept share error: \(error)") }else{ //Share accepted... } } CloudKit.container.add(operation) I am also previously subscribed to the Shared database already like so: let subscriptionSharedDatabase = CKDatabaseSubscription

CloudKit - What to do when a user adds, modifies or deletes an object while offline?

别来无恙 提交于 2019-12-10 11:17:52
问题 I am running into the issue of what to do when a user does a delete, for example, while offline? I was considering using an addedQueue, modifiedQueue, and deletedQueue, and persisting them using NSCoding and NSKeyedArchiver . Maybe I would use a Set or a Dictionary. Then I would iterate over them in the background or once every app launch, and remove from them on success. Does that sound reasonable? Does anyone have experience with this problem they can share? I've done quite a bit of

How to use “fetchWithRecordID” for automatically generated ID in CloudKit Dashboard?

孤街醉人 提交于 2019-12-10 10:11:20
问题 I'm new to CloudKit and iOS development. I've manually added some records to the CloudKit Dashboard, and now I want to retrieve them by their IDs, which were automatically created. And then I want to display a record's value in a UILabel for a static tableview cell. Having two issues: 1). I'm getting an error in xCode when using the ID from the dashboard (error says "expected "," separator") ; and 2). I can't find any examples of putting a record value in a UILabel in a static tableview cell.

How to modify CloudKit Reference Lists

我怕爱的太早我们不能终老 提交于 2019-12-09 23:53:15
问题 I can modify the Reference List attribute of my CKRecord in the dashboard without problems, but how can I modify it programmatically? I currently try modifying it as a NSArray. It does not give me any sort of error but even though the array content is fine, the attribute does not get set. Also the documentation on reference lists is either well-hidden or non-existent. CKReference *reference = [[CKReference alloc] initWithRecord:connectionRecord action:CKReferenceActionNone]; NSMutableArray

iOS swift: Store cache using coredata (cloudkit)

家住魔仙堡 提交于 2019-12-09 21:13:55
问题 I'm learning to use cloudkit to save and fetch records, but I got confused about saving cache to coredata. For example, I fetched several records and display a few attributes of this record type(say, A, C and F) using a tableview. And when I click a cell, it'll show this record's detail ( all attributes of this record: A B C D E F, but don't including reference attributes record). I was wondering should I store these things into coredata when I fetched the record at the first time: "A C F and

iCloud + Core Data today (10th july 2015)

徘徊边缘 提交于 2019-12-09 04:13:40
问题 Some years ago Apple released the iCloud sync of Core Data apps. Then I released an app for iPad / iPhone / MAC with a shared model using the new Apple mechanism. Things have not gone as expected. The sync mechanism sometimes doesn't work. For example, the last months, in my case, rarely the sync ends well through my 3 devices. Uploading objects in general works fine. But the download process of new or deleted objects normaly crash. Apple released some time ago a way to force the devices to

How (and when) do I use iCloud's encodeSystemFields method on CKRecord?

依然范特西╮ 提交于 2019-12-08 23:09:45
问题 encodeSystemFields is supposed to be used when I keep records locally, in a database. Once I export that data, must I do anything special when de-serializing it? What scenarios should I act upon information in that data? As a variation (and if not covered in the previous question), what does this information help me guard against? (data corruption I assume) 回答1: encodeSystemFields is useful to avoid having to fetch a CKRecord from CloudKit again to update it (barring record conflicts). The

Querying CloudKit Users Record gives “Can't query system types”

眉间皱痕 提交于 2019-12-08 21:23:32
问题 Okay, so I'm building a game on top of CloudKit and I want to query the users with the top 50 scores for a leaderboard. // Create a CKQuery let predicate = NSPredicate(value: true) let sortDescriptor = NSSortDescriptor(key: "score", ascending: false) var query = CKQuery(recordType: "Users", predicate: predicate) query.sortDescriptors = [sortDescriptor] // Create a query operation var queryOperation = CKQueryOperation(query: query) queryOperation.resultsLimit = 50 queryOperation

Cloudkit: “ error saving record WRITE operation not permitted”

拈花ヽ惹草 提交于 2019-12-08 15:40:20
问题 I'm trying to save a record CloudKit but I'm getting the following error from cloudkit: error saving record este es error: Error saving record <CKRecordID: 0x7fef15b5d2a0; 2:(_defaultZone:__defaultOwner__)> to server: WRITE operation not permitted Here is how I'm trying to save the record: [publicDatabase saveRecord:recordContent completionHandler:^(CKRecord *record, NSError *error){ if (!error) { NSLog(@"saved!!!"); } else { if ([[error.userInfo valueForKey:@"ErrorDescription"]

How to condition segues using CloudKit query?

蹲街弑〆低调 提交于 2019-12-08 11:24:17
问题 I created a login page backed up by CloudKit. I want to know how to create a conditioned segue if the login has a certain value, and then direct the user to a View Controller based on that value In details, I have three Segues I want to connect: sign in id segue: LoginSuccessSegue staff tab bar id segue: idStaffTabBar student tab bar id segue: idStudentTabBar First Segue LoginSuccessSegue : the sign in view controller has a show segue id LoginSuccessSegue the connects to staff tab bar