4
votes

CloudKit creates a unique User record and adds to the Public database when a user launches your app for the first time. For debugging purposes, I'm trying to delete this such that CloudKit can generate a new unique ID that is different from the one before.

However when trying to delete said record using the CloudKit Dashboard, I get the following error:

invalid attempt to delete user records directly

I get the same error when trying to delete it in code using the deleteRecordWithID: method.

Does anyone know the correct way of deleting a user record? Is it even possible? Are there any other solutions that will solve my problem by forcing a new record being created?

1
Could you please tell me, what your CloudKit Development Environment is.G.Alexander
Method : forceDelete Declaration : RecordsBatchBuilder forceDelete (CloudKit.Record|CloudKit.Record[] records);G.Alexander
@Alexander environment is development, I have not yet pushed anything to production. I will attempt the forceDelete method once I have a chance.Aleksander
That method is part of CloudKit JS - I am developing this on an iOS device, and I cannot find any reference to neither RecordBatchBuilder nor forceDelete in the iOS SDK of CloudKit.Aleksander
@Genki unfortunately, noAleksander

1 Answers

0
votes

I found a workaround that might not be ideal but it was better than nothing. I was able to delete the user by resetting the whole development database in the development environment.

If the User in question is the same as the one you used to log in to CloudKit Dashboard, you might not be able to delete it. In that case, you can use another iCloud account and that user should get removed every time you reset development environment.

enter image description here