To build the data objects (classes) for the MasterProduct entity defined in the data model, follow the given steps:
We find two files: MasterProduct.h
and MasterProduct.m
(Customer.h, Customer.m, Product.h
, and Product.m
were already there) generated in the Classes folder of the Xcode Project window with the following contents:
// MasterProduct.h // prob #import <CoreData/CoreData.h> @interface MasterProduct : NSManagedObject { } @property (nonatomic, retain) NSNumber * price; @property (nonatomic, retain) NSNumber * quantity; @property (nonatomic, retain) id image; @property (nonatomic, retain) NSString * itemname; @end
In the preceding code, we see that the properties are defined with the names: price, quantity, image
, and itemname
. These properties are not declared in the header file as they will be created dynamically.
The implementation file, MasterProduct.m
will have the following code by default:
// MasterProduct.m // prob #import "MasterProduct.h" @implementation MasterProduct @dynamic price; @dynamic quantity; @dynamic image; @dynamic itemname; @end
In the implementation file, we find that the properties are marked as dynamic to inform the compiler not to generate accessors and mutators for the properties and will be generated by the super class at runtime and hence not to display any warning message related to them.
3.138.114.154