I'm looking to use Core Data within my iPhone app.
The app doesn't really need to store the data that is used, but it needs to be managed and queryable.
Can Core Data be used for datasets that exist purely in memory and are not persisted to the disk?
Absolutely, just set the store type to NSInMemoryStoreType. More specifically, you set it up like this:
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
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With