Exception when calling Logout method for iOS. Met...
# multiplatform
d
Exception when calling Logout method for iOS. Method on the shared repo:
Copy code
suspend fun doLogout(token: String) {
    val userId = appService.currentUser!!.id
        realm.write {
            var user = query<UserInfo>("_id = $0", userId).first().find()
            if (user != null) {
                user = findLatest(user)!!.also {
                    it.FCMToken.remove(token)
                }
                copyToRealm(user)
            }
    }
    withContext(Dispatchers.Default) {
        appService.currentUser?.logOut()
    }
}
the way that I call on the swiftUI:
Copy code
func doLogout(){
    repo.doLogout(token: myFCMToken){error in
      
    }
  }
e