Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to call designated initializer on NSManagedObject class 'ClassName'

I am using mogenerator.I am getting CoreData error as follows:

Failed to call designated initializer on NSManagedObject class 'ClassName'.

Anybody please help me to solve this error.

like image 739
S.P. Avatar asked Aug 14 '10 15:08

S.P.


3 Answers

Don't alloc / initalise something that you already have a hand on.. that's why !

Example of use in a cellForRowAtIndexPath

Use ClassName *class = [arrayOfSomething objectAtIndex:indexPath.row];

Instead of ClassName *class = [ClassName alloc] init]; class = [arrayOfSomething objectAtIndex:indexPath.row]

like image 113
Marc Avatar answered Oct 29 '22 21:10

Marc


You need to show the associated code before anyone can assist. Otherwise we are just guessing.

Show how you are initializing ClassName.

like image 43
Marcus S. Zarra Avatar answered Oct 29 '22 19:10

Marcus S. Zarra


Do not alloc init your Bean class, instead use following method to set Bean:

-(void)setBean:(YourBeanClassName *)obj
{
    objBean = obj;
}
like image 37
Dhaval Parmar Avatar answered Oct 29 '22 19:10

Dhaval Parmar