我在一个项目中使用 RealmSwift,我时不时会收到一个
Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'
我没有从我的 Realm 数据库中删除任何对象,所以问题不是对象在其他地方被删除了。
还有哪些选择?
最佳答案
我知道是旧线程,但我也刚遇到这个问题。当对象在错误的线程上时,您也会看到该错误:
// throw an exception if the object is invalidated or on the wrong thread
static inline void RLMVerifyAttached(__unsafe_unretained RLMObjectBase *const obj)
{
if (!obj->_row.is_attached()) {
@throw RLMException(@"Object has been deleted or invalidated.");
}
[obj->_realm verifyThread];
}
关于swift - 一个 Realm 对象如何在不被删除的情况下变得无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30162688/