cloudkit

CloudKit notifications

自作多情 提交于 2019-12-18 16:51:56
问题 I might be missing something obvious here. How would one create a CloudKit notification with detail about the CKRecord that you are being notified about? (i.e. not just a generic "New Item Created!" but a notification with the title of the record for instance, like, "Jill and Jessica's Birthday Party!") Is the proper way to do this to create a new subscription with a new notification.alertBody for every new record change? That doesn't make any sense. That leaves the option queryNotification

Limit the amount of results returned in CloudKit

一笑奈何 提交于 2019-12-18 16:34:10
问题 Is there any way to limit the amount of results that are returned in a CKQuery ? In SQL , it is possible to run a query like SELECT * FROM Posts LIMIT 10,15 . Is there anything like the last part of the query, LIMIT 10,15 in CloudKit? For example, I would like to load the first 5 results, then, once the user scrolls down, I would like to load the next 5 results, and so on. In SQL, it would be LIMIT 0,5 , then LIMIT 6,10 , and so on. One thing that would work is to use a for loop, but it would

CloudKit not returning the most recent data

早过忘川 提交于 2019-12-18 14:52:49
问题 I am having this issue where I save something to the icloud using CloudKit but immediately fetching the results doesn't return the latest data inserted. Example let todoRecord = CKRecord(recordType: "Todos") todoRecord.setValue(todo, forKey: "todotext") publicDB.saveRecord(todoRecord, completionHandler: { (record, error) -> Void in NSLog("Saved in cloudkit") let predicate = NSPredicate(value: true) let query = CKQuery(recordType: "Todos", predicate: predicate) self.publicDB.performQuery(query

CloudKit count records

怎甘沉沦 提交于 2019-12-18 03:13:07
问题 I have a "table" that can potentially have many records, when adding a new record I need to know how many records there already are in current table as I use it in calculation of some values. The closest thing I could find is requesting all entries like this: var query : CKQuery = CKQuery(recordType: "Stars", predicate: NSPredicate(format: "mass > 0")) var request : CKQueryOperation = CKQueryOperation(query: query) var starCount = 0 request.queryCompletionBlock = { (cursor:CKQueryCursor!,

Error _BSMachError: (os/kern) invalid capability (20) after receiving remote notification on CloudKit record addition

眉间皱痕 提交于 2019-12-17 23:32:16
问题 When I receive a remote notification on a record addition (didReceiveRemoteNotification called), I get the following error message: _BSMachError: (os/kern) invalid capability (20) I've already tried to find out more about this in forums and via Google but I could not find any helpful advice that applies to my situation. What does the error message mean? What can I do about it? 回答1: I just experienced this error. I was in a UIAlert Action block; when the block exited the error occurred (BTW

CloudKit: Zone was purged by the user

假装没事ソ 提交于 2019-12-14 03:54:30
问题 One of my users deleted their cloud data, and now they are getting a "Zone was purged by the user" message. I believe it is returning error CKErrorUserDeletedZone, when fetching the zone. The documentation states the following: The user deleted this zone through the settings UI. Your client should either remove its local data or prompt the user before attempting to re-upload any data to this zone. */ It is not clear whether I should delete the zone and create it again. Has anyone gone through

Storing images in CloudKit as CKAsset, image upside-down

廉价感情. 提交于 2019-12-14 01:28:47
问题 I am working on developing an app that uses CloudKit to store and retrieve image files as CKAsset objects. Normally, this works great and I love CloudKit's small learning curve. Periodically though, I have this peculiar issue where an image is being stored either totally upside-down, or 90º to the left or to the right. Here is an example of an image that was stored improperly: I took that picture with my iPhone 5s, in portrait orientation (I didn't save the original image to my device, as I

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(

Can I transfer CloudKit data to a new Container?

烂漫一生 提交于 2019-12-13 15:41:39
问题 I'm making a CloudKit app, and I'm faced with the choice of storing my data in the default container, accessible only by that app, or a custom container that can share data. For now I only need that app to access the data, so I would probably put my data in the default container. However, if eventually I want to access this data from a different app, can I transfer my user data to a custom, shareable container? 回答1: No need to transfer your data: the default container can be used from your

How can user discoverability permission revoked in CloudKit?

痞子三分冷 提交于 2019-12-13 14:51:26
问题 I am curious wether user can somehow change discoverability permission. I haven't found a way in Settings. 回答1: You can set it on your device in Settings / iCloud / iCloud Drive / Find via Email 来源: https://stackoverflow.com/questions/26883345/how-can-user-discoverability-permission-revoked-in-cloudkit