Re: Having problem with fetch request in NSDocument based application

2009-09-05 Thread Brent Gulanowski
Perhaps you would like to compare your code to some open source code that's out there. I've got a persistent document-based app available here: http://bitbucket.org/bgulanowski/branchline/ The app is alpha and moribund, but the Core Data part works fine. It uses SQLite, not XML, but you could cha

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread Clayton Leitch
URL is correct and entity is not nil. On Sep 4, 2009, at 12:55 PM, Brent Gulanowski wrote: So, all the other objects leading to the fetch execute look OK? Your context isn't nil? Does your context actually have the right store coordinator with the right store URL? Does NSEntityDescription return

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
On Sep 4, 2009, at 10:48 AM, Clayton Leitch wrote: I re-typed everything in a freshly produced document based application. So you created a new Core Data Document based application and put your code and data model into it, and it's still not working correctly? I'm utterly mystified.

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread Clayton Leitch
I re-typed everything in a freshly produced document based application. Below is the top of the MyDocument.h file. // // MyDocument.h // Blood Pressure Record // // Created by Clayton Leitch on 9/3/09. // Copyright __MyCompanyName__ 2009 . All rights reserved. // #import @interface MyDoc

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
On Sep 4, 2009, at 10:38 AM, Clayton Leitch wrote: The debugger shows 0 objects in the array. Interestingly, this same code works perfectly in a non-NSDocument version of this application. Wait, when you say it works in a non-NSDocument-based version, it makes me wonder: did you copy cod

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread Clayton Leitch
The debugger shows 0 objects in the array. Interestingly, this same code works perfectly in a non-NSDocument version of this application. On Sep 4, 2009, at 10:29 AM, I. Savant wrote: On Sep 4, 2009, at 10:24 AM, Clayton Leitch wrote: Yes, I saved it as XML and opened the file. Below is wh

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
On Sep 4, 2009, at 9:47 AM, Clayton Leitch wrote: fetchedObjects = nil; ... fetchRequest = [[NSFetchRequest alloc] init]; ... fetchedObjects = [context executeFetchRequest:fetchRequest error:&error]; ... [fetchRequest release]; One other thing (memory-manageme

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
On Sep 4, 2009, at 10:24 AM, Clayton Leitch wrote: Yes, I saved it as XML and opened the file. Below is what I found: Okay, so since there're definitely some instances in the store, and nothing is nil in the debugger, the only thing remaining is your message delivery. ... have you s

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread Clayton Leitch
Yes, I saved it as XML and opened the file. Below is what I found: 134481920 E968A00D-5333-4E12-909D-8709A682BBB7 124 NSPersistenceFrameworkVersion 246 NSStoreModelV

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
Taking this back on-list where it belongs. On Sep 4, 2009, at 9:53 AM, Clayton Leitch wrote: Yes, there is a Measurement instance in the the data model. Debugger shows that everything is set properly until the array gets no objects in answer to the query. Are you sure? How have you

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread Andy Lee
Are any objects along the way nil? --Andy On Sep 4, 2009, at 9:47 AM, Clayton Leitch wrote: Here is the code in MyDocument: -(IBAction)calculateStat:(id)sender{ fetchedObjects = nil; context = [self managedObjectContext]; fetchRequest = [[NSFetchRequest alloc] init]; e

Re: Having problem with fetch request in NSDocument based application

2009-09-04 Thread I. Savant
On Sep 4, 2009, at 9:47 AM, Clayton Leitch wrote: Here is the code in MyDocument: -(IBAction)calculateStat:(id)sender{ fetchedObjects = nil; context = [self managedObjectContext]; fetchRequest = [[NSFetchRequest alloc] init]; entity = [NSEntityDescription entityForName:@

Having problem with fetch request in NSDocument based application

2009-09-04 Thread Clayton Leitch
Here is the code in MyDocument: -(IBAction)calculateStat:(id)sender{ fetchedObjects = nil; context = [self managedObjectContext]; fetchRequest = [[NSFetchRequest alloc] init]; entity = [NSEntityDescription entityForName:@"Measurement" inManagedObjectContext:context];