• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: coredata framework daemon-safe?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: coredata framework daemon-safe?
      • From: Bill Bumgarner <email@hidden>
    • Re: coredata framework daemon-safe?
      • From: mmalcolm crawford <email@hidden>
References: 
 >coredata framework daemon-safe? (From: "P Smith" <email@hidden>)
 >Re: coredata framework daemon-safe? (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Authentication & suid tool
  • Next by Date: Re: undo in a sheet
  • Previous by thread: Re: coredata framework daemon-safe?
  • Next by thread: Re: coredata framework daemon-safe?
  • Index(es):
    • Date
    • Thread