Jas*_*ien 7 iphone persistence core-data
我想在我的iPhone应用程序中使用Core Data.
该应用程序并不真正需要存储使用的数据,但需要进行管理和查询.
核心数据可以用于纯粹存在于内存中并且不会持久存储到磁盘的数据集吗?
Lou*_*arg 18
当然,只需将商店类型设置为NSInMemoryStoreType即可.更具体地说,你设置如下:
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
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1713 次 |
最近记录: |