Bader Al-Rasheed
Bader Al-Rasheed

Reputation: 468

How to delete all objects in Realm at run time

How can i delete all objects in Realm at run time ?

I've already seen this question but the answer can only be used at the launch of the app. But I want to delete everything at launch time. How can i do this ?

Upvotes: 0

Views: 1544

Answers (1)

yoshyosh
yoshyosh

Reputation: 14086

For now you will need to do this for each object type:

RLMResults *arrayOfObjects = [Person allObjects]; [realm deleteObjects:arrayOfObjects];

We're working on a way to make this easier

[realm beginWriteTransaction];
[realm deleteAllObjects];
[realm commitWriteTransaction];

Upvotes: 3

Related Questions