I'm assigning values to 3 objChordFun (Core Data object) properties. The problem is the degree property. Its contents are being released somewhere inside the loop. What's wrong? I'd be grateful for some help.
for (TonalScale *tonalScale in [TonalScale all]) {
NSOrderedSet *tsScales = [NSOrderedSet orderedSetWithOrderedSet:tonalScale.scale];
Scale *tsScale = [tsScales objectAtIndex:0];
NSOrderedSet *degrees = tsScale.degree;
for (int i=0; i<[tsScale.degree count]; i++) {
Degree *degree = [degrees objectAtIndex:i];
Scale *scale = [tsScales objectAtIndex:i];
NSSet *chords = [NSSet setWithSet:scale.chord];
for (Chord *chord in chords) {
for (Tonality *tlt in [Tonality all]) {
objChordFun = [ChordFunction create];
objChordFun.degree = degree;
objChordFun.chord = chord;
objChordFun.tonality = tlt;
}
}
}
}