cloudkit

CloudKit - full and complete error handling example

你离开我真会死。 提交于 2019-12-03 10:17:13
问题 Apple are very clear, in every video they state that "The difference between a CloudKit app which handles errors and one that doesn't is the difference between a working app and one that doesn't". However, I can't find anywhere a proper list of what each error means, which Operations throw what or any example code of CloudKit error handling done well for various CKOperations. Even worse, many examples don't handle errors at all and I can't find any documentation from Apple either. Does anyone

Saving CloudKit Record “Not Authenticated” (9/1002)“ ”This request requires an authenticated account“”

走远了吗. 提交于 2019-12-03 10:06:12
Saving a CKRecord in the simulator gives me the following error: [publicDatabase saveRecord:cloudRouteEntity completionHandler:^(CKRecord *record, NSError *error) { if (error) { NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error); abort(); } else { dispatch_async(dispatch_get_main_queue(), ^(void) { //gui NSLog(@"Created Cloudkit Entity"); }); } }]; However, it works on the phone. Why does the simulator not have access to the CloudKit database? EDIT: I thought I'd be clever by adding the iCloud account to the simulator - but iCloud moans that this is not allowed on "this

CloudKit: “Internal Error” (1/4000); “Couldn't get a signing certificate”>

蓝咒 提交于 2019-12-03 09:22:38
I'm running on simulator and the app works fine, but once on an iPhone device it crashes with - An error occured in discoverUserInfo:: The discoverUserInfo is copied code from Apple's CloudKit sample code below. Is this something on Apple's end, or mine? - (void)discoverUserInfo:(void (^)(CKDiscoveredUserInfo *user))completionHandler { [self.container fetchUserRecordIDWithCompletionHandler:^(CKRecordID *recordID, NSError *error) { if (error) { [self showAlert]; // In your app, handle this error in an awe-inspiring way. NSLog(@"An error occured in %@: %@", NSStringFromSelector(_cmd), error); /

Deleting data from cloudkit with swift

别来无恙 提交于 2019-12-03 08:23:59
How do I delete some data I put into the cloud? I made an app that when you enter a url in 1 view controller it uploads into the cloud, and when you go to another view controller it shows the url you entered before from the cloud in a webview. for example, when you enter www.hello.com, it goes into the cloud, and when you go to the webview on a different view controller it loads www.hello.com. My problem: When I enter a second url, it still loads the first one. How do I get it to load the latest one I uploaded? Is there a way to delete the first one when the second one is uploaded? You can

Not receiving CloudKit push notifications for Custom Record Zone on the Mac

筅森魡賤 提交于 2019-12-03 07:16:15
I've setup a custom zone subscription to receive (silent) push notifications from my custom record zone. Everything works fine on my iOS devices but I'm not able to receive the notifications on my Mac. To register the notifications I'm registering the notification type in applicationDidFinishLaunching : [[NSApplication sharedApplication] registerForRemoteNotificationTypes:NSRemoteNotificationTypeNone]; (Tried the other types with the same result) application:didRegisterForRemoteNotificationsWithDeviceToken: is then called with a valid token. Everything seems fine but when the custom zone

CloudKit - NSPredicate for finding all records that contain specified CKReference in a reference list

我与影子孤独终老i 提交于 2019-12-03 03:51:47
I am working on a CloudKit backed app with a Users record type that has a "following" reference list attribute. I am trying to construct a query to get every user that is following a specified user (i.e. those users in which the specified user appears as an entry in the following reference list). I am currently trying to construct my NSPredicate for the CKQuery as such: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"%@ IN following", [[CKReference alloc] initWithRecordID:currentUserID action:CKReferenceActionNone]]; CKQuery *query = [[CKQuery alloc] initWithRecordType

Anonymously Log In to an App with iCloud Apple ID

非 Y 不嫁゛ 提交于 2019-12-03 03:26:00
According to this CloudKit overview : CloudKit also enables your users to anonymously sign in to your apps with their iCloud Apple IDs without sharing their personal information. I can't find anything else in their documentation about this capability. I already have an app with my own backend, so I wouldn't need any of the back-end-as-a-service features that CloudKit offers, but I would like to take advantage of logging a user in with their iCloud account, much the same way we currently do with Facebook and Twitter. Is that possible with CloudKit, or do you also have to leverage their BAAS

How to receive cloudkit notifications about changes made on record shared with me?

痴心易碎 提交于 2019-12-03 03:23:23
I have two icloud accounts ( A and B ) on two different devices. From one of them ( A ) I share ckrecord to another one ( B ) like this: let controller = UICloudSharingController { controller, preparationCompletionHandler in let share = CKShare(rootRecord: record) share[CKShareTitleKey] = "title" as CKRecordValue share[CKShareTypeKey] = "pl.blueworld.fieldservice" as CKRecordValue share.publicPermission = .readWrite let modifyOperation = CKModifyRecordsOperation(recordsToSave: [record, share], recordIDsToDelete: nil) modifyOperation.savePolicy = .ifServerRecordUnchanged modifyOperation

How to query CloudKit for recordID IN [CKRecordID]

為{幸葍}努か 提交于 2019-12-03 03:04:24
My predicate wants to exclude some records that are already downloaded and available in a [CKRecordID]. Now I can query 1 CKRecordID[0], but not the [CKRecordID] array. How can I query the array? let excludeIDs: [CKRecordID] This works: let pred1 = NSPredicate(format: "NOT(recordID = %@)", excludeIDs[0]) But this doesn't: let pred1 = NSPredicate(format: "NOT(recordID IN %@)", excludeIDs) ERROR: loadImageCompareRecordIDsAndEndDateThatHaveNotEnded Error: Invalid predicate: Invalid predicate: Array members must conform to CKRecordValue: ( "", "", "", "", "" ) (CKRecordID) The other general parts

How to set up a minimal CKSubscription?

爷,独闯天下 提交于 2019-12-03 02:57:31
I want to set up a simple CKSubscription that notifies me a recordType was created, how? After experimenting a while this is how to setup a minimal CKSubscription. You have to test it on Device, push notification does not work on simulator. You can add record in Dashboard, that will trigger push notification too. func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool { application.registerUserNotificationSettings(UIUserNotificationSettings(forTypes: .Alert, categories: nil)) application.registerForRemoteNotifications() return true }