Is persistent storage a requirement for Core Data on iPhone?

I want to use Core Data in my iPhone app.

The application really does not need to store the data that is used, but they need to be managed and requested.

Can Core Data be used for datasets that exist exclusively in memory and are not stored on disk?

+7
iphone core-data persistence
source share
1 answer

Absolutely just set the storage type to NSInMemoryStoreType. In particular, you configure it as follows:

NSError *error = nil; //Ignore that it is called an "NSPersistentStore", it is not persisted NSPersistentStore *inMemoryStore = [persistentStoreCoorindator addPersistentStoreWithType:NSInMemoryStoreType configuration:nil URL:nil options:nil error:&error]; if (inMemoryStore && !error) { //It is setup } 
+18
source share

All Articles