Re: Null-Pointers from a to Many array
Re: Null-Pointers from a to Many array
- Subject: Re: Null-Pointers from a to Many array
- From: Chuck Hill <email@hidden>
- Date: Tue, 05 Oct 2004 13:53:01 -0700
To many relationships should always return an object that is instanceof
NSArray. The only reasons for this not be the case are if you are abusing
EOF, have spelling errors in key names, or data integrity problems.
I've never seen a relationship contain EOKeyValueCoding.NullValue or
anything similar. You can get that if you create your own array using KVC
to populate it, but EOF should never do so.
Chuck
At 01:36 PM 05/10/2004 -0700, Tim Kliewer wrote:
>If you are retrieving the objects directly from the entity
>("myObjects()"), it should just return an empty array. Occasionally,
>if the entity is brand new, I have seen a null or
>EOKeyValueCoding.NullValue value as the array; I don't remember
>exactly, its been a while. Refreshing the object typically clears that
>issue.
>
>If you are accessing the array through KVC methods
>(valueForKey/valueForKeyPath), unfortunately, you will get the
>occasional EOKeyValueCoding.NullValue as an element (or two) if there
>is nothing assigned in its "parent" entity.
>
>What I do is get a mutableClone of the array and
>"removeObject(EOKeyValueCoding.NullValue)". That removes ALL nulls. A
>necessary evil...
>
>If I am wrong here, PLEASE someone correct me!!!
>
>TNK
>
>On Oct 4, 2004, at 3:45 PM, Greg Hulands wrote:
>
>> Hi,
>> When I try to access the array of a to many relationship and it
>> contains no records, instead of returning an empty array, it returns
>> null. I am using wonder if that makes a difference. Is this a normal
>> thing? It seems a pain in the ass that each time I want to iterate
>> over a to many array I have to check to see if it isn't null.
>>
>> Am I doing something wrong?
>>
>> Regards,
>> Greg
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list (email@hidden)
>> Help/Unsubscribe/Update your Subscription:
>> email@hidden
>>
>> This email sent to email@hidden
>>
>>
>Tim Kliewer
>Software Engineering
>Apple, Sacramento Operations
>2911 Laguna Blvd Tel: (916) 394-5101
>MS: 204-B2 Fax: (916) 394-5502
>Elk Grove, CA 95758 E-mail: email@hidden
>
> _______________________________________________
>Do not post admin requests to the list. They will be ignored.
>Webobjects-dev mailing list (email@hidden)
>Help/Unsubscribe/Update your Subscription:
e.net
>
>This email sent to email@hidden
>
--
Chuck Hill email@hidden
Global Village Consulting Inc. http://www.global-village.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden