Re: Analyzing Core Data Conflict List
Re: Analyzing Core Data Conflict List
- Subject: Re: Analyzing Core Data Conflict List
- From: Steve Steinitz <email@hidden>
- Date: Wed, 4 Feb 2009 17:34:19 +1100
Hi Ben,
Oops, I omitted some key information in the previous message...
We wrote:
Here's what I added to awakeFromNib in my NSArrayController subclass:
[request setRelationshipKeyPathsForPrefetching:
[NSArray arrayWithObjects: @"customer",
@"salesPerson",
@"payments",
@"lineItems",
@"bikes",
@"riskPoints",
nil
]];
Which seems to work and may even speed application startup a
little. However, thinking about it, will that have a lasting
effect on object freshness? Or will it only affect startup?
It can speed things up, if you going to access those related objects
imminently anyway. -awakeFromNib only happens on startup.
You want:
- (BOOL)fetchWithRequest:(NSFetchRequest *)fetchRequest merge:(BOOL)merge error:(NSError **)error;
What I actually did in my arrayController's awakeFromNib is
NSFetchRequest * request = [self defaultFetchRequest];
followed by the setRelationshipKeyPathsForPrefetching, above.
That should make every subsequent vanilla fetch do the
prefetching. Correct? And, if so, wouldn't that be an
alternative to calling fetchWithRequest? Or, does the merge
option do something different from a vanilla fetch? I thought
I'd only want to use fetchWithRequest if I needed to temporarily
use a different fetch than the default fetch.
And you may wish to refetch periodically as the app gets used.
To clarify, even after I set the prefetch keys they're not going
to get used until I manually do another fetch. Correct?
Times when the user changes actions is a place to consider. Such as
waking the machine from sleep,
bringing the app to the foreground,
or opening a new window.
Nice list -- but they rarely happen in our point of sale
system. What I might consider is refetching when certain
windows become frontmost. Or, I've been toying with the idea of
refetching in idle time.
You want to avoid refetching if there are pending edits, so fetching
just before the user starts editing is another option.
That's a great idea (as long as it doesn't introduce too much of
a typing delay).
Thanks again Ben,
Steve
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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