Re: create managed object programmaticly
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