I think you are mistaken. I clicked the option "Remove App", and I got a message saying that app name will be released to other developers and put in my removed apps list. I think you are correct that I can add that app back anytime, just that I might have to use a different name if another developer decides to use the name I had been using before I removed the app.
Post
Replies
Boosts
Views
Activity
Those are hacks. Surely Apple has an official fix for this.
Yes. I got that. I noted in my post that property is of type NSObject in my managed object class. I don't know what to set it to instead of NSObject.
Ok. I added the code after I changed it. I didn't fill in the parameters.
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.
Ok. Thank you very much.
Do you mean by 'completionBlock' the completion closure of the privateDatabase.perform(_:_:) method?
I think you are working on the problem that the printNumberOfRecords() method is printing the wrong number of records. That's not the problem I'm concerned with. I am concerned that the records are not deleted.
I don't follow. Would you show me in my code what you mean?
That still doesn't fix the problem that the records don't get saved. When I query the database later, there still is not 688 records saved like it appears to have saved when I perform the CKModifyRecordsOperation. I actually checkd in CloudKit Dashboard. There really are 32 records only.
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.
Your print number of records is working now. When I ran it that one time it counted 687 insteaed of 688.
Maybe when it counted short it ran before all the records were saved.
Yeah. That's a good idea. I didn't think about that.Ok. I marked your first answer as correct, because that was where you pointed out the problem.
Thanks.