ckrecord

CloudKit: Fetch all records with a certain record type?

你。 提交于 2020-05-09 22:52:41
问题 I have currently got CloudKit set up in my app so that I am adding a new record using the help of the following code below, CKRecordID *recordID = [[CKRecordID alloc] initWithRecordName:@"stringArray"]; CKRecord *record = [[CKRecord alloc] initWithRecordType:@"Strings" recordID:recordID]; [record setObject:[NSArray arrayWithObjects:@"one", @"two", @"three", @"four", nil] forKey:@"stringArray"]; [_privateDatabase saveRecord:record completionHandler:nil]; However, now I would like to be able to

Trying to modify ckrecord in swift

心已入冬 提交于 2020-01-07 08:35:32
问题 I want the users' location to be updated in cloudkit but my code just save a new record every time. How can the existing record be modified or replaced by the new one? func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) { let location = locations.last let center = CLLocationCoordinate2D(latitude: location!.coordinate.latitude, longitude: location!.coordinate.longitude) let region = MKCoordinateRegion(center: center, span: MKCoordinateSpan(latitudeDelta

How to query CloudKit for recordID IN [CKRecordID]

扶醉桌前 提交于 2019-12-20 12:38:45
问题 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:

How would I save an object of type DateComponents to a CloudKit field?

情到浓时终转凉″ 提交于 2019-12-13 17:47:28
问题 I am using Swift for an iOS app. I need to store a DateComponents object as a field in CloudKit. How would I do that? So far I think I need to set the CloudKit field to type Bytes, and convert the DateComponents object to a Data object. Looking at the documentation for the Data class, I can't figure out how to initialize the Data object. I have no idea how to use the UnsafeBufferPointer used in one of the initializers. The following code gives a runtime error: newRecord.setObject(

How do I get a list of RecordTypes in a Database?

为君一笑 提交于 2019-12-13 03:59:45
问题 I want to list all records in a Database. To do this using CKQuery, it appears I must have a recordType. The predicate will be TRUEPREDICATE. How can I get a list of RecordTypes, for eventual use within CKQuery? (e.g. I'll loop through the list, and create new CKQuery objects at run time.) 回答1: As strange as it may seem, there is no way to determine what record types exist in a Cloud Kit database. Your code should be creating records with specific record types so your code should already know

CKFetchRecordsOperation + CKQueryOperations … what am I missing?

女生的网名这么多〃 提交于 2019-12-10 22:39:49
问题 Managed to cobble together a CKFetchRecordsOperation after much searching for sample code; and here it is... but I must have missed something. Don't get me wrong it works a treat... but... To execute a CKFetchRecordsOperation you need an NSArray of CKRecordIDs; to get a NSArray of CKRecordIDs, you need to execute CKQuery thru which you can build your NSArray of CKRecordIDs. But wait a minute, the process of extracting the CKRecordIDs uses a CKQuery, thru which I could simply download the

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

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"]

creatorUserRecordID.recordName contains “__defaultOwner__” instead of UUID shown in Dashboard

馋奶兔 提交于 2019-12-07 05:09:46
问题 Downloading a CKRecord from CloudKit and when plotting creator recordName , I can see this: (lldb) po record.creatorUserRecordID.recordName __defaultOwner__ but, Dashboard show a real value. Why the difference?! I hope I do not have to download only because of this the logged in user first?! 回答1: "__defaultOwner__" mean's its owned by the currently logged in iCloud account. So you could replace that with "Me" or the person's name if you have it. If you want to find out the logged in user's

creatorUserRecordID.recordName contains “__defaultOwner__” instead of UUID shown in Dashboard

二次信任 提交于 2019-12-05 09:50:48
Downloading a CKRecord from CloudKit and when plotting creator recordName , I can see this: (lldb) po record.creatorUserRecordID.recordName __defaultOwner__ but, Dashboard show a real value. Why the difference?! I hope I do not have to download only because of this the logged in user first?! "__defaultOwner__" mean's its owned by the currently logged in iCloud account. So you could replace that with "Me" or the person's name if you have it. If you want to find out the logged in user's recordID you can use the asynchronous method fetchUserRecordIDWithCompletionHandler. Jay it is a bug edit this