5

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?

6
  • Could you please tell me, what your CloudKit Development Environment is. Commented Jun 21, 2018 at 0:59
  • Method : forceDelete Declaration : RecordsBatchBuilder forceDelete (CloudKit.Record|CloudKit.Record[] records); Commented Jun 21, 2018 at 1:02
  • @Alexander environment is development, I have not yet pushed anything to production. I will attempt the forceDelete method once I have a chance. Commented Jun 22, 2018 at 0:49
  • 1
    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. Commented Jun 22, 2018 at 0:53
  • 1
    @Genki unfortunately, no Commented Jun 16, 2020 at 15:23

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

1 Comment

This is what I found too. Unfortunately this also resets the Security Roles. However, in theory it "resets" to the production version, so after the reset I recreated the Security Roles and pushed it to production before populating any data records.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.