Re: memory management issue?
Re: memory management issue?
- Subject: Re: memory management issue?
- From: Steven Crosley <email@hidden>
- Date: Fri, 1 Feb 2008 12:29:51 -0600
Thanks for all the suggestions. I changed the function based on them,
and now it dies the fifth or sixth time I access it, but on the third
time I get a more friendly error message:
[NSCFString valueForProperty:]: unrecognized selector sent to instance
0x1b90e0
So at least there's progress. Thanks again!
Steven
- (void) getSelectedBuyer:(NSString*)uid
{
NSAssert( uid != nil, @"Should have gotten a uid");
NSManagedObjectContext *moc = [self managedObjectContext];
NSAssert( moc != nil, @"What, no MOC?");
NSEntityDescription *buyerEntity = [NSEntityDescription
entityForName:@"Buyer" inManagedObjectContext:moc];
NSAssert( buyerEntity != nil, @"Should have gotten an entity");
NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:buyerEntity];
NSPredicate *predicate = [NSPredicate predicateWithFormat: @"active =
YES AND uid = %@", uid];
[request setPredicate:predicate];
NSError *error = nil;
NSArray *array;
array = [moc executeFetchRequest:request error:&error];
if ((error != nil) || (array == nil)) {
NSLog(@"Error while fetching\n%@",
([error localizedDescription] != nil) ? [error
localizedDescription] : @"Unknown Error");
exit(1);
}
NSEnumerator *buyerEnumerator = [array objectEnumerator];
[buyer release];
buyer = [[buyerEnumerator nextObject] retain];
NSLog(@"%@", [buyer uid]);
[buyer setAddressBook];
}
On Feb 1, 2008, at 11:46 AM, Chris Suter wrote:
On 02/02/2008, at 4:13 AM, Steven Crosley wrote:
[buyer release];
buyer = [buyerEnumerator nextObject];
You're not retaining buyer. Where do you do that?
- Chris
_______________________________________________
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