0
私は時間、拍、レートの3つの属性を持つ単一のエンティティ 'testData'を持っています。毎回 'time'属性をトラバースして、対応するビートとレートの値をそれぞれのNSMutable配列に格納する必要があります。iOSコアデータの単一のエンティティをトラバースする
NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
NSEntityDescription *entity = [[self.fetchedResultsController fetchRequest] entity];
NSManagedObject *newManagedObject = [NSEntityDescription insertNewObjectForEntityForName:[entity name] inManagedObjectContext:context];
[newManagedObject setValue:[x] forKey:@"timeStamp"];
[newManagedObject setValue:[y] forKey:@"beat"];
[newManagedObject setValue:[z] forKey:@"rate"];
// Save the context.
NSError *error = nil;
if (![context save:&error]) {
// Replace this implementation with code to handle the error appropriately.
// abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development.
NSLog(@"Unresolved error %@, %@", error, [error userInfo]);
abort();
あなたは「時間属性をトラバース」とはどういう意味ですか?あなたのコードは新しいエンティティを作成するためのものですが、あなたの質問は既存のエンティティの取得と解析です。あなたの質問は何ですか? – Mundi