'Error while adding new data in realm in swift
I am trying to create table and add 1st row in realm table. But getting below error
realm?.write {
let Model = Feedback()
Model._id = UUID().uuidString
Model.data1 = data1
Model.data2 = data2
Model.message = message
realm?.add(Model, update: .all)
}
Feedback model ->
class Feedback: Object {
@objc dynamic var _id: String = ""
@objc dynamic var data1: String = ""
@objc dynamic var data2: Int = 0
@objc dynamic var message: String = ""
override static func primaryKey() -> String? {
return "_id"
}
}
Error I am getting this
*** Terminating app due to uncaught exception 'RLMException', reason: 'Object type 'Feedback' is not managed by the Realm. If using a custom `objectClasses` / `objectTypes` array in your configuration, add `Feedback` to the list of `objectClasses` / `objectTypes`.'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
