Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSArray instance variable and core data objects



Thanks for the responses. I've collated them together

The order in which the values are retrieved is important therefore I was attempting to create a NSArray instance variable to store an ordered list of managed objects.

How are you intending to use and store the array?
Is there any attribute on which you could simply sort the input characteristic types?

The order of the objects is only important when the program is executed. Values from the objects are fed into a external library. Therefore, I have no desire to add an additional variable to the managed object model.


from source file:
inputCharacteristicTypes = [NSArray arrayWithArray:[[self mutableSetValueForKey:@"inputCharacteristicTypes"] allObjects]];


This is unnecessarily inefficient.
There is no need to create a mutable proxy ('mutableSetValueForKey:') since you don't use it; 'allObjects' returns a new array, so there is no need to create another array using it.

Fair point.

A few things are not clear to me.

What is this entity CharacteristicType?

A sub-classed managed object that implements a few custom methods.

The error message implies that a binding is involved. What is this
binding?

I didn't think any bindings were involved...

The error massage also implies that the CharacteristicType entity is
an NSArray. Is there an declaration error that says that the entity
instance is an array?

The CharacteristicType entity was supposed to be a managed object...

This all got me thinking that maybe I'd missed something...

This morning I realised that that the error was actually a result of the name I'd given the instance variable. The variable name, inputCharacteristicTypes, matched one of the relationships of the managed object which was causing all the trouble. I'm guessing that after running through the method which defined the inputCharacteristicTypes NSArray the program refreshed the UI, causing a binding to fire. However, instead of finding an NSSet for the relationship via key-value coding my program returned the newly defined NSArray causing an error.

After fixing this error everything works.

Cheers

Tim



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/email@hidden

This email sent to email@hidden
References: 
 >NSArray instance variable and core data objects (From: Tim McDonald <email@hidden>)
 >Re: NSArray instance variable and core data objects (From: mmalc crawford <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.