Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>The classes which Xcode creates for handling core data objects should not be overridden, instead what you could do is create your own custom class which inherits from NSObject and write your methods to handle the managed object their. </p> <p>Sol: You can do this with the help of the parameterized init method</p> <p>Then it would look something like this</p> <pre> CoreDataHelperClass *someobj = [[CoreDataHelperClass alloc]initWithname:@"name" andTimeStamp:@"Time" andMuscleGroup:@"musclegroup" andPicture:UIImagePNGRepresentation(someimageObj)]; </pre> <p>To do the above you need to add your own init method in the CoreDataHelperClass class like this</p> <p>.h part of CoreDataHelperClass </p> <pre> - (id)initWithName:(NSString*)name andTimeStamp:(NSString*)timeStamp andMuscleGroup:(NSString*)group andPicture:(NSData*)imageData; </pre> <p>.m part of CoreDataHelperClass </p> <pre> - (id)initWithName:(NSString*)name andTimeStamp:(NSString*)timeStamp andMuscleGroup:(NSString*)group andPicture:(NSData*)imageData { //you assignment code to the core data attributes goes here ExerciseForRoutine *obj = [[ExerciseForRoutine alloc]init]; obj.name = name; obj.timestamp = timeStamp; //and so on return self; } </pre> <p>Anyways what you could also do is pass a dictionary with the keyvalue pair get the values in your custom class or you may also pass an NSMutableArray like what ever suits your business model both will work.</p> <p>You can get the values of Dictionary or Array inside your CoreDataHelperClass and assign those values to your attribute.</p> <p>Hope i have got your query right if not then kindly mention the error part via comments</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload