简体   繁体   中英

Error saving context in Magical Record with Swift 3

I used the library Magical Record on Swift 3 and got an error when I call the method saveToPersistentStoreAndWait() (Screenshot here) .The data is not saving in the database.

The error is "This application is modifying the autolayout engine from a background thread after the engine was accessed from the main thread. This can lead to engine corruption and weird crashes"

I strongly disagree that the error message is related to your database. I think that is related to your view as "autolayout" is mentioned.

Anyways, how can you say that the data is not saved? What I see in the log is "finished saving" and "new 942 inserted objects." If it failed (to save) it should have displayed something like "failed to save" or log the error message. Pay attention to your logs.

How are you accessing the data after you tried to save it? Maybe the problem lies here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM