objective c - Unrecognized selector when populating an NSManagedObject -
I have an iPad app using core data In my data model I have an object named Hubreb and using XCode NSManaged objects are generated. The generated object has the following code:
Header:
@class HubModel; @ Interface Hub Brand: NSManagedObject @property (nonatomic, retain) NSString * brandName; @property (nontomic, rETAIN) nsat * rallamoles; @end @ Interface Hubbrand (Cordata Generated Recipients) - (Zero) addRelModelsObject: (HubModel *) value; - Remove (zero )Reload Model object: (Hombodel *) value; - (zero) addRelModels: (NSSet *) value; - (zero) DeleteRailload Model: (NSSet *) value; @end Implementation:
@implementation HubBrand @ dynamic brandName; @ Dynamic rellamos; @end I am trying to create an example of the HubBrand class and populate it using the foloowing code:
HubBrand * brand = [ [HubBrand alloc] in this]; [Brand Set Brand Name: [NSString stringWithFormat: @ "_Custom:,% @", [_txtHubBrand text]]]; //brand.brandName = [NSString stringWithFormat: @ "_Custom:,% @", [_txtHubBrand Text]]; When I do this, I get the following runtime error: - [Hubbrand Set: Brendanum:]: Unrecognized selector sent for example
generated Using the managed objects, do I need to implement my own setters? Why am I getting a clue as to this error? Thanks!
You must create an example of a sub class based on it:
< code> NSManagedObjectContext * Managed objectContax; // Get it from your core data stack, possibly app representative hubbrand * brand = [NSTTTDCature DineAvEFFFOEFFORMNAME: @ Managed Object Contains in "Hubbrand": Managed Object Contex]; [Brand Set Brand Name: [NSString stringWithFormat: @ "_Custom:,% @", [_txtHubBrand text]]]; See the doctor's section for more information.
You can also use the sub-class initiator:
NSEntityDescription * entity = [NSEntityDescription EntityForName: @ Managed object contact in "HubBrand": Managed Object Contex] ; Hubbrand * Brand = [[Hubbroke Allok] Init with Entity: Entity Dint in Managed Object Contact: Managed Object Contex]; But its a bit more vocabulary!
Comments
Post a Comment