Re: Having problem with fetch request in NSDocument based application
Re: Having problem with fetch request in NSDocument based application
- Subject: Re: Having problem with fetch request in NSDocument based application
- From: Andy Lee <email@hidden>
- Date: Fri, 04 Sep 2009 09:52:56 -0400
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];
entity = [NSEntityDescription entityForName:@"Measurement"
inManagedObjectContext:context];
[fetchRequest setEntity:entity];
fetchedObjects = [context executeFetchRequest:fetchRequest
error:&error];
if (fetchedObjects == nil) {
NSLog(@"error");
[errorMessage setStringValue:@"no objects"];
}else {
[errorMessage setIntValue:[fetchedObjects count]];
}
[fetchRequest release];
The fetchedObjects count is always 0. Any idea what silly thing I
forgot.
Thanks
_______________________________________________
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
_______________________________________________
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