我在一个项目中使用RealmSwift并不时地得到一个
Terminating app due to uncaught exception 'RLMException', reason: 'Object has been deleted or invalidated.'
我没有从我的领域数据库中删除任何对象,因此问题不是该对象已被删除。
还有其他选择吗?
答案 0 :(得分:1)
旧线程我知道,但我也遇到过这个问题。当对象在错误的线程上时,您还会看到该错误:
// 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];
}