【发布时间】:2011-11-08 03:18:39
【问题描述】:
我在我的应用程序中大量使用 Core Data。人口众多,引人入胜。但是,我的应用程序变得非常缓慢。请您提出一些优化建议。
我正在使用以下代码从 Core Data 中获取数据:
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:entityName inManagedObjectContext:[(RICAELLEAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext]];
[fetchRequest setEntity:entity];
NSError* error;
NSArray *fetchedObjects = [[(RICAELLEAppDelegate *)[[UIApplication sharedApplication] delegate] managedObjectContext] executeFetchRequest:fetchRequest error:&error];
在视图中,每次都会出现。对吗?
【问题讨论】:
-
另外,不确定是否有足够的代码来弄清楚发生了什么。您是否进行了测量和分析?