如何使用Realm进行安全删除

时间:2017-09-19 03:47:09

标签: swift realm

有时候app崩溃说对象已被删除。

请告诉我如何删除catch异常。

1 个答案:

答案 0 :(得分:1)

如果对象无效,则必须检查对象

if !myObject.isInvalidated {
    //the object exists and it is safe to handle it
}