Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何在运行时删除 Realm 中的所有对象?
我已经看过这个问题,但答案只能在应用程序启动时使用。但我想在启动时删除所有内容。我怎样才能做到这一点 ?
现在,您需要为每种对象类型执行此操作:
RLMResults *arrayOfObjects = [Person allObjects]; [领域 deleteObjects:arrayOfObjects];
我们正在努力使这更容易
[realm beginWriteTransaction]; [realm deleteAllObjects]; [realm commitWriteTransaction];