I am trying to configure the realm with the help of the below function. Initially, there was only EmailAccount class after adding ApplicationAccount class while writing to EmailAccount cluster it is working but for ApplicationAccount it is saying Cannot write to class ApplicationAccount when no flexible sync subscription has been created.
How to solve this ??
override fun configureTheRealm() { if (user != null) { val config = SyncConfiguration.Builder(user, setOf(EmailAccount::class, ApplicationAccount::class)) .initialSubscriptions { sub -> add( query = sub.query<EmailAccount>("ownerId == $0", user.id), name = "User's EmailAccounts" ) add( query = sub.query<ApplicationAccount>("ownerId == $0", user.id), name = "User's Application Account" ) } .log(LogLevel.ALL) .build() realm = Realm.open(config) Log.d("USERID", "$user") } }
I have already tried terminating the sync and then enabling it again. But the same error is happening.