가져 오기 요청을 실행해야합니다. 하지만 내가 그것을 할 때 나는 NSManagedObject
(각각의 객체는 약 5Mb 임) 오류가 없기 때문에 메모리 경고를 받는다. Apple은 코어 데이터 (객체가 RAM에로드되지 않은 경우)에 대해 가능성을 제공합니다. 그리고 나는이 목표를 사용하기 위해 내 물건을 원한다.핵심 데이터. ExecuteFetchRequest 오류가있는 NSManagedObjects (RAM이 아님)
여기에 내 코드 술어가 (id < 500)
입니다
+ (NSMutableSet *)GetImagesWithPredicate:(NSPredicate *)predicate
{
NSString *entityName = kEntityName;
AppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];;
NSManagedObjectContext *context = appDelegate.managedObjectContext;
NSEntityDescription *entityDesctiption = [NSEntityDescription
entityForName: entityName
inManagedObjectContext:context];
// find object
NSFetchRequest *request = [[NSFetchRequest alloc] init];
[request setEntity:entityDesctiption];
[request setPredicate:predicate];
NSArray *objects = [context executeFetchRequest:request error:nil];
[request release];
if (objects == nil)
{
NSLog(@"there was an error");
return nil;
}
NSMutableSet *set = [NSMutableSet setWithArray:objects];
return set;
}
입니다.
NSArray *objects = [context executeFetchRequest:request error:nil];
객체의 모든 데이터가 아이폰의 RAM에 나타나기 때문에 후
응용 프로그램이 충돌합니다.
기본 옵션 returnsObjectsAsFaults = YES
이 작동하지 않는 것 같습니다.
오류 로그를 게시 할 수 있습니까? 또한 모델 및 이미지 (크기)에 대해 설명하십시오. –
오류 로그가 없습니다. 그냥 메모리 경고하고 추락했습니다. 5 개의 객체 만 가져 오려고했는데 모든 것이 OK입니다 (fetchLimit 설정) –