• 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: Dominik Pich <email@hidden>
  • Date: Tue, 18 Dec 2007 21:46:23 +0100

Well.. of course you are right - I didnt see the Problem there - and I do see that Problem.
The crash is not because of that though.....


In gdb
I cant po  [destinationObject description]
I can po [destinationObject class] though

Regards,
Dominik

Am Dec 18, 2007 um 7:16 PM schrieb Jim Correia:

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: Jim Correia <email@hidden>
References: 
 >create managed object programmaticly (From: Dominik Pich <email@hidden>)
 >Re: create managed object programmaticly (From: Jim Correia <email@hidden>)

  • Prev by Date: Re: Making custom key-commands
  • Next by Date: Re: create managed object programmaticly
  • Previous by thread: Re: create managed object programmaticly
  • Next by thread: Re: create managed object programmaticly
  • Index(es):
    • Date
    • Thread