views:

29

answers:

1

In Core Data, if I have a Person entity is there any difference between:

NSManagedObject *aPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[self managedObjectContext]];

or

Person *aPerson = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[self managedObjectContext]];

Should aPerson be of type Person or NSManagedObject? Is there a difference?

A: 

You should declare it as aPerson class. That way the complier know the exact class type.

Kevin Franke