'RealmSwiftPermission' is not managed by the Realm

cloud

#1

I have issue. In my realm cloud i have realm “Locations” where i store locations for my map. Every user should have access to this realm and get through query nearest annotations. But i faced with problem: only administrators have permission for this not regular users ( how it intended to be). For solving this problem i add following code to my ViewController:

                    try! self.realm.write {
                    let everyonePermission = self.realm.permissions.findOrCreate(forRoleNamed: "everyone")
                    everyonePermission.canRead = true
                    everyonePermission.canQuery = true
                    }

and then i planned to add this role to every user but i faced with another issue:

Terminating app due to uncaught exception ‘RLMException’, reason: ‘Object type ‘RealmSwiftPermission’ is not managed by the Realm. If using a custom objectClasses / objectTypes array in your configuration, add RealmSwiftPermission to the list of objectClasses / objectTypes.’ *** First throw call stack: (0x1845fad8c 0x1837b45ec 0x10122830c 0x101264100 0x101cb2308 0x100cf42bc 0x101cb13a8 0x100cf3ffc 0x100cf35dc 0x1027b11dc 0x1027b119c 0x1027b5d2c 0x1845a3070 0x1845a0bc8 0x1844c0da8 0x1864a5020 0x18e4dd758 0x100cf9720 0x183f51fc0) libc++abi.dylib: terminating with uncaught exception of type NSException

What should i do to resolve this? Many thanks.Or probably there is another way to give permission for every user to access to that realm?


#2

I’m not sure my solution will resolve your problem or not, maybe you can give it a try.