1
我想計算我的核心數據中的對象數,以便我可以告訴有多少行需要我的表視圖控制器,但我堅持計數的NS陣列,這裏是代碼計數問題與NS託管對象和NS陣列
NSFetchRequest *request = [[NSFetchRequest alloc] init];
request.entity = [NSEntityDescription entityForName:@"Data" inManagedObjectContext:context];
NSSortDescriptor *sortDescriptor =
[[NSSortDescriptor alloc] initWithKey:@"date"
ascending:YES
selector:@selector(localizedCaseInsensitiveCompare:)];
request.sortDescriptors = [NSArray arrayWithObject:sortDescriptor];
NSError *error = nil;
NSArray *temp=[context executeFetchRequest:request error:&error];
我做它在數據類(子類nsmanged對象的),問題是,當我到達
NSLog(@"%@",[temp count]);
我得到「程序接收到的信號:」 EXC_BAD_ACCESS」 ' 我得到了什麼是錯的,我把我的數據放入ns數組中比試圖數它們。在這方面的幫助將不勝感激。
我不能相信我過來看了它,它這麼小,但尚未嚴重的錯誤。謝啦 –