/ Published in: Objective C

Just change the filename "courses" to that of your own and the entity name "Course" to your own.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
]; NSManagedObject *mObj = [NSEntityDescription insertNewObjectForEntityForName:@"Course" inManagedObjectContext:[self managedObjectContext]]; id value = [keyedValueDict objectForKey:attribute]; if (value == nil) { // Don't attempt to set nil, or you'll overwite values in self that aren't present in keyedValues continue; } NSAttributeType attributeType = [[attrs objectForKey:attribute] attributeType]; value = [value stringValue]; } else if (((attributeType == NSInteger16AttributeType) || (attributeType == NSInteger32AttributeType) || (attributeType == NSInteger64AttributeType) || (attributeType == NSBooleanAttributeType)) && ([value isKindOfClass:[NSString class]])) { } [mObj setValue:value forKey:attribute]; NSLog(@"Value %@ for Key %@", value, attribute); } } NSError *error; [[self managedObjectContext] save:&error];
Comments
