• 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: create managed object programmaticly
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: create managed object programmaticly


  • Subject: Re: create managed object programmaticly
  • From: Jim Correia <email@hidden>
  • Date: Tue, 18 Dec 2007 13:16:41 -0500

On Dec 18, 2007, at 12:59 PM, Dominik Pich wrote:

following (partly) the core data low level tutorial I tried created a managed object for my custom entity by code.

It looks ok but crashes in the 2. NSLog.... well maybe because I use garbage collection?

code:
- (IBAction)saveJobInHistory:(id)sender {
id destinationObject = [NSEntityDescription insertNewObjectForEntityForName:[historyController entityName] inManagedObjectContext:[historyController managedObjectContext]];

if(destinationObject) {
NSLog(@"got instance of entity");
NSLog([destinationObject description]);
}
}

Do not ever pass an arbitrary string you got from somewhere else as a formatting string to printf, NSLog, etc.


If that string contains formatting characters, you will crash as the function will try to read va_args that were not passed and get garbage.

The correction form is

	NSLog(@"%@", [destinationObject description]);

Jim

_______________________________________________

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


  • Follow-Ups:
    • Re: create managed object programmaticly
      • From: Dominik Pich <email@hidden>
References: 
 >create managed object programmaticly (From: Dominik Pich <email@hidden>)

  • Prev by Date: Re: cancelOperation: does not work for trapping the escape key
  • Next by Date: Re: cancelOperation: does not work for trapping the escape key
  • Previous by thread: create managed object programmaticly
  • Next by thread: Re: create managed object programmaticly
  • Index(es):
    • Date
    • Thread