Re: Fetch request problem with core data relationship and NSTableView
Re: Fetch request problem with core data relationship and NSTableView
- Subject: Re: Fetch request problem with core data relationship and NSTableView
- From: "I. Savant" <email@hidden>
- Date: Fri, 15 Jun 2007 07:32:45 -0400
On Jun 15, 2007, at 6:55 AM, Danny Callanan wrote:
NSArray *tempArray = [moc executeFetchRequest:request error:&error];
[self setToCurrency:[self [tempArray lastObject]]];
This is very crudely bringing back the last Currency object (I'll
want to refine this).
First, no it's not. Since the order of fetched objects is not
guaranteed by Core Data, you're getting "some Currency instance" but
not necessarily the last one added. A "sortOrder" or "createdOrder"
key would be needed (and sorted upon) to guarantee order.
All appears to work except that the UI shows two new rows rather
than one when the user adds a Charge object. This appears to be a
problem with UI only however since if I quit the application and re-
open it only a single row appears.
1 - How are you creating the Charge instance?
2 - Do you mean specifically there are two Charge instances in a
table that lists Charges?
3 - Are the two objects really different objects or are they the
same object listed twice? (there are a number of ways to test this -
I leave that up to you)
4 - What happens if you force your array controller to -fetch:
after you create your Charge instance?
--
I.S.
_______________________________________________
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:
This email sent to email@hidden