0

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 ?

Community
  • 1
  • 1
Bader Al-Rasheed
  • 458
  • 1
  • 7
  • 13

1 Answers1

3

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];
yoshyosh
  • 13,956
  • 14
  • 38
  • 46