Answer the question
In order to leave comments, you need to log in
Why are objects not saved in the Realm database?
I receive data from the server and immediately write it to the database (asynchronously):
//В теле Alamofire.request()
autoreleasepool{
let db = try! Realm()
db.autorefresh = true
let myObject = MyObject()
myObject.cloneFromAnotherObject(cur)
myObject.lang = myObjectServ.lang.lowercased()
try! db.write {
db.add(myObject)
}
db.refresh()
}
let configuration = Realm.Configuration(
schemaVersion: 3,
deleteRealmIfMigrationNeeded: true)
Answer the question
In order to leave comments, you need to log in
I did not find a solution to the problem and switched to using Core Data.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question