Re: coredata framework daemon-safe?
Re: coredata framework daemon-safe?
- Subject: Re: coredata framework daemon-safe?
- From: "P Smith" <email@hidden>
- Date: Wed, 17 May 2006 13:21:11 +0530
Thanks.
While saving to a file for the first time, my daemon crashes at [ moc save]
Code looks like this:
void writeToCoreData()
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSManagedObjectModel *mom = managedObjectModel();
if (applicationSupportDirectory() == nil)
{
NSLog(@"Could not find application support directory...");
}
NSManagedObjectContext *moc = managedObjectContext();
NSEntityDescription *myEntity = [[mom entitiesByName]
objectForKey:@"Entity"];
// Entity class is inherited from NSManaged object has accessor
methods to set and get attributes
Entity *entity = [[[Entity alloc] initWithEntity:myEntity
insertIntoManagedObjectContext:moc] autorelease];
[ myEntity setName : [NSString stringWithCString: fileName]];
-
-
NSError *error = nil;
[moc lock];
if([moc save: &error])
{
//handle error
}
[moc unlock];
[pool release];
On 5/17/06, Bill Bumgarner <email@hidden> wrote:
On May 16, 2006, at 10:27 PM, P Smith wrote:
> Is coredata.framework daemon safe? Can I use NSManagedObjectContext
> in a
> daemon?
Yes.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden