Cloudkit request permission not working

I am trying to request the users permission to share their information using this function: func requestPermission() {     CKContainer.default().requestApplicationPermission([.userDiscoverability]) { [weak self] returnedStatus,       returnedError in       DispatchQueue.main.async {         if returnedStatus == .granted {         self?.permissionStatus = true         }       }     }   }

But it is not working. I am signed into my apple id and it still is not working. Any ideas?

What is the error? Are you on simulator? Can you use a device with iCloud account signed in

This call presents UI only once per user, per instance of the CloudKit container. To continue to test the experience of the user interface in your dev environment, reset the schema in the CloudKit dashboard.

Cloudkit request permission not working
 
 
Q