Post

Replies

Boosts

Views

Activity

Reply to Why are not all records being saved in a CKModifyRecordsOperation to save in CloudKit in iOS?
I think my error was in checking the records after the save. The records were there, I just didn't retrieve it all, so it looks like not all are there. When I checked in CloudKit Dashboard, there were more not loaded. I was only looking at the first load before I loaded more.By the way, your print number of records code was short one. I wonder if you forgot to count the last run of the getChunk.
Apr ’20
Reply to NSCoding error messages using NSKeyedUnarchiver.unarchivedObject(ofClass:from:)
Here's what code I have now: let defaultFileManager: FileManager = FileManager.default let standardUserDefaults = UserDefaults.standard let ubiquityIdentityToken = defaultFileManager.ubiquityIdentityToken let oldDataUbiquityIdentityToken = standardUserDefaults.data(forKey: UserDefaultsKeys.ubiquityIdentityToken) do { // Save ubiquity identity token let dataUbiquityIdentityToken: Data = try NSKeyedArchiver.archivedData(withRootObject: ubiquityIdentityToken!, requiringSecureCoding: false) standardUserDefaults.set(dataUbiquityIdentityToken, forKey: UserDefaultsKeys.ubiquityIdentityToken) let oldUbiquityIdentityToken = try NSKeyedUnarchiver.unarchivedObject(ofClass: (NSCoding & NSCopying & NSObjectProtocol).self, from: oldDataUbiquityIdentityToken!) } catch { print(error) }Here are the red code-time errors that appear on the line below the comments in the code:'NSCoding & NSCopying & NSObjectProtocol' cannot be used as a type conforming to protocol 'NSCoding' because 'NSCoding' has static requirementsStatic method 'unarchivedObject(ofClass:from:)' requires that 'NSCoding & NSCopying & NSObjectProtocol' inherit from 'NSObject'I get the argument I put in for the 'forClass' parameter from the declaration of FileManager.ubiquityIdentityToken in Apple's documentation, which says:@NSCopying var ubiquityIdentityToken: (NSCoding & NSCopying & NSObjectProtocol)? { get }What threw me off at the beginning is the fact that the errors appear before I even put in the arguments in the placeholders.
Apr ’20