Data Model Versions and -fetchRequestTemplateForName
Data Model Versions and -fetchRequestTemplateForName
- Subject: Data Model Versions and -fetchRequestTemplateForName
- From: Steve Cronin <email@hidden>
- Date: Sun, 20 Sep 2009 21:18:25 -0500
Folks;
I have recently converted to XC & IB 3.2
I've updated my project to be a 3.2 project using a baseSDK of 10.6
with deployment target of 10.4
I have a Core Data model that I've been very happy with starting in
10.4 and continuing in 10.5..
In readying for the brave new world ahead I have added a 'version' to
the data model.
I see 2 xcdatamodel documents (app1 and app2) - they are the same at
this point
After bring the app up to the tools and project setting described
above I've begun testing the release product on Tiger, Leopard , and
Snow Leopard.
The following method worked fine on all 3 OSes before these changes
- (NSArray *) elementsByTemplate:(NSString *) templateName {
NSError *error = nil;
NSArray *results;
//moc is an instance variable for the managedObectContext
NSFetchRequest * fReq = [[[moc persistentStoreCoordinator]
managedObjectModel] fetchRequestTemplateForName:templateName];
@try { results = [moc executeFetchRequest:fReq error:&error]; }
@catch ( NSException *e ) { NSLog(@"(Template:%@) Caught %@: %@ \r
%@", templateName, [e name], [e reason], [e userInfo]); }
if ( error != nil) { NSLog(@"%@ - Caught %i: %@ info = %@",
NSStringFromSelector(_cmd), [error code], [error domain], [error
userInfo]); }
return ( (results==nil) ? [NSArray array] : results);
}
This fails on Tiger BUT continues to work normally on Leopard & Snow
Leopard.
fReg is NULL on Tiger (used to work fine on Tiger)
so the exception get caught with 'fetch request must have an entity)
[Yeah - so I do see that I should test for a null fetchRequest but
that's not the issue really!]
Is the model versioning the problem? Can I 'undo' that?
(I can't do a 'fetchRequestTemplatesByName' because that was
introduced in 10.5)
Is there something I can do or that I am overlooking?
I have backed the base SDK down to 10.5 (I can easily because I just
made that change to 10.6 and have no embedded 10.6 code as yet)
It still fails for Tiger.
I have also removed app2 from the xcdatamodeld bundle but this also
does not change the result.
I'm stumped on what to do to remedy this situation!
Thoughts?
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