0

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;  
                }  
            }  
        }  
    }  
  • This is very convoluted. Why do you have names for ordered sets that are in the singular? It is not clear where your `all` and `create` functions come from and what exactly they do. You should show your data model to clarify. – Mundi Aug 29 '13 at 22:50
  • And how is the title - "value instead of address" - related to the question? – Martin R Aug 30 '13 at 04:47
  • Thanks, Mundi. You are right. I was assigning the same value to several objects, while the data class declares a one-to-one relationship. Stupid. Took me a week. – Even Northug Aug 30 '13 at 22:17

0 Answers0