cloudkit

Fetch Record Assets in CloudKit Using Swift

谁都会走 提交于 2019-12-06 16:17:53
I am new to CloudKit and I am having trouble connecting the assets in my database to the ImageView and TextView in my app. In my CloudKit database, under record types, I created a record named "Companies". I then went to Public Data->Default Zone and then created a new instance of the record called "myCompany". In "myCompany" I have two assets, an image and a .txt file. I want to connect those assets to my app. I am not sure if I need to use CKQuery or what is the best approach. Any advice would be much appreciated. Below is what I have so far. Feel free to give feedback of what I have or if

iCloud versus iCloud Drive versus CloudKit

人盡茶涼 提交于 2019-12-06 15:39:15
Would I be correct in assuming that a user of my iOS app that uses CloudKit would not need to pay a monthly fee to Apple to use my CloudKit app? Apple just changed from annual to monthly for anything above 5GB for iCloud... or is it unrelated? I've been hunting around Apples development site and I cannot seem to find a reference for who gets charged a fee for use of CloudKit. WWDC made brief reference that there is a limit that can be reached and it seemed like they were indicating that the developer would have to pay Apple if their user base exceeded a certain point. If that's the case, a

Cloudkit: CKDatabaseOperation not working on cellular

与世无争的帅哥 提交于 2019-12-06 14:27:54
Hi to all the CloudKit users: I had a horrible time trying to find out why CKDatabaseOperation wouldn't give any feedback. No errors, no callbacks when saving CKRecords on cellular. Could you please let me know what is your opinion regarding this? Someone in the Developer Forums of Apple found a solution: https://forums.developer.apple.com/thread/20047 the magic happens when setting qualityOfService = .UserInitiated Example: let publicDB = CKContainer.defaultContainer().publicCloudDatabase let operation = CKModifyRecordsOperation(recordsToSave: [aRecord], recordIDsToDelete: nil) operation

Creating an NSCache for the first time with CloudKit Records - close?

可紊 提交于 2019-12-06 14:00:57
问题 I have a project I'm close to completing. My last problem arises when I've downloaded CloudKit records to an array to be displayed in a tableview. Here is my code for the query portion of the controller. for result in results! { let tablerestaurant = Restaurant() if let name = result.value(forKey: "Name") as! String? { tablerestaurant.name = name } // Do same for image if let imageAsset = result.object(forKey: "Picture") as! CKAsset? { if let data = try? Data(contentsOf: imageAsset.fileURL) {

Handling CloudKit Errors

核能气质少年 提交于 2019-12-06 07:18:46
问题 I am looking for general advice on handling CloudKit errors in Swift and am having trouble finding good examples online. Here are the things I'm wondering: 1) Should I account for every single error type each time the possibility for an error arises, or is that not really necessary? 2) I have read that one common way of handling CloudKit errors is by retrying to execute the operation after the time interval the error message provides. Should this retry basically be my standard procedure for

CloudKit Unexpected Expression for NSPredicate

北战南征 提交于 2019-12-06 07:18:10
问题 I'm using CloudKit and wish to perform a search for records based on their string fields. Apple docs say this is the way to do a tokenized search of a record's fields: To perform a tokenized search of a record’s fields, use the special operator self. A tokenized search searches any fields that have full-text search enabled, which is all string-based fields by default. Listing 5 shows an example that searches the fields of the record for the token strings bob and smith. Each distinct word is

CloudKit share private Container between users

爷,独闯天下 提交于 2019-12-06 07:05:38
问题 I'm planning to develop an App used to share infos about geographic locations (coordinates, notes, pics), a kind of Treasure Hunt and I did not understand if it is possible, using CloudKit, to share part of a private container between users. If it is, how can I do that? I'd need to create something like Apple does in the Reminders App, where a user can "invite" other users and have a common list to share between them all where everybody can insert or edit stuff. Eventually if it's not

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

杀马特。学长 韩版系。学妹 提交于 2019-12-06 06:38:06
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 searching for answers, including watching all the CloudKit WWDC talks. I am storing all of my data locally

CloudKit didReceiveRemoteNotification not called on the Mac

十年热恋 提交于 2019-12-06 06:36:46
I am using the following CKNotification Info and this seems to work fine: CKNotificationInfo *note = [[CKNotificationInfo alloc] init]; note.alertBody = @"Something Happened"; note.shouldBadge = NO; note.shouldSendContentAvailable = NO; When something changes on an iOS device, my Mac app receives a Push notification based on a subscription with this notification. However, didReceiveRemoteNotification is never called so I can't process the event. I need to be able to refresh and fetch new changes. How do I do that? Calling registerForRemoteNotificationTypes: and implementing

CloudKit - “Invalid bundle ID for container”

不想你离开。 提交于 2019-12-06 04:56:21
I've just create a project in Xcode 9 beta 6 and add this code: let privateDB = CKContainer.default().privateCloudDatabase let greatID = CKRecordID(recordName: "GreatPlace") let place = CKRecord(recordType: "Place", recordID: greatID) privateDB.save(place) { (record, error) in if error != nil { let er = (error as! CKError).errorUserInfo print("Error: \n") print("CKErrorDescription: \(er["CKErrorDescription"]!)\n") print("ContainerID: \(er["ContainerID"]!)\n") print("NSDebugDescription: \(er["NSDebugDescription"]!)\n") print("NSUnderlyingError: \(er["NSUnderlyingError"]!)\n") print(