Skip to content

Instantly share code, notes, and snippets.

@EchoAbstract
Created June 26, 2012 19:57
Show Gist options
  • Select an option

  • Save EchoAbstract/2998484 to your computer and use it in GitHub Desktop.

Select an option

Save EchoAbstract/2998484 to your computer and use it in GitHub Desktop.
Managed Object
@implementation managedObject
@synthesize managedObjectContext;
+ (NSDictionary *)kinveyObjectBuilderOptions
{
static NSDictionary *options = nil;
if (options == nil){
options = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], KCS_USE_DESIGNATED_INITIALIZER_MAPPING_KEY,nil];
}
return options;
}
+ (id)kinveyDesignatedInitializer
{
NSManagedObjectContext *moc = [[AppDelegate sharedAppController] managedObjectContext];
NSEntityDescription *newsEntity = [NSEntityDescription entityForName:@"managedObject" inManagedObjectContext:moc];
NSManagedObject *object = [[NSManagedObject alloc] initWithEntity:myEntity insertIntoManagedObjectContext:moc];
// We're using ARC, so we don't need to autorelease the object, arc *should* take care of that for us
return object;
}
- (NSDictionary *)hostToKinveyPropertyMapping
{
return [NSDictionary dictionaryWithObjectsAndKeys:
@"title", @"title",
@"eventDescription", @"eventDescription",
@"subtitle", @"subtitle",
@"_id", @"kinveyID", nil];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment