I need to do is to build two different apps, both under my developer account. Give one to the user to see the data in the database, and keep one handy to me to change this database. I am using CloudKit, default container and public database.
So what I have tried for now is I have one app for user let's say app name is "showdata". In that app I use the default container and public database like this:
let publicDatabase = CKContainer.default().publicCloudDatabase
And then I use this to perform query:
query = CKQuery(recordType: "updateAndHold", predicate: NSPredicate(format: "TRUEPREDICATE"))
publicDatabase.perform(query!, inZoneWith: nil) { (records, error) in
In the second app let's name it "updatedata". What I should do to use the same database and container to update the data. I have tried this code:
let container = CKContainer.init(identifier: "iCloud.com.WMWIOS.showdata").publicCloudDatabase
But when I fetch for any record it gives me error that no entitlement with that name:
query = CKQuery(recordType: "updateAndHold", predicate: NSPredicate(format: "TRUEPREDICATE"))
container.perform(query!, inZoneWith: nil) { (records, error) in
And when I print(publicDatabase) and print(container) it has different IDs but same identifier.
I need help with that issue. If you need any more info please let me know.
