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: Tim Kliewer <email@hidden>
- Date: Tue, 5 Oct 2004 13:36:24 -0700
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:
This email sent to email@hidden