Can any one tell me how to remove all the NSObject of CoreData at a same time ?
Currently i have done with for loop but i think it is not good way also taking more time when size of data is more, Thanks in advance.
Can any one tell me how to remove all the NSObject of CoreData at a same time ?
Currently i have done with for loop but i think it is not good way also taking more time when size of data is more, Thanks in advance.
You can still delete the file programmatically, using the NSFileManager:removeItemAtPath:: method.
NSPersistentStore *store = ...;
NSError *error;
NSURL *storeURL = store.URL;
NSPersistentStoreCoordinator *storeCoordinator = ...;
[storeCoordinator removePersistentStore:store error:&error];
[[NSFileManager defaultManager] removeItemAtPath:storeURL.path error:&error];
Then, just add the persistent store back to ensure it is recreated properly.
The programmatic way for iterating through each entity is both slower and prone to error.
Just removing the store and recreating it is both fast and safe, and can certainly be done programmatically at runtime.