Created
November 7, 2013 21:34
-
-
Save stevegraham/7362210 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Cannot init an NSManagedObject. Have to insert into an NSManagedObjectContext instance. | |
NSManagedObjectSubclass * scratchObj = [NSEntityDescription insertNewObjectForEntityForName:@"Foo" | |
inManagedObjectContext:AppDelegate.managedObjectContext]; | |
// Set the properties on our object, e.g. via UITextField IBOutlets | |
scratchObj.foo = @"foo"; | |
// Post the object. Assume use of an RKMapping here. | |
[[RKObjectManager sharedManager] postObject:scratchObj path:nil parameters:nil | |
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { | |
// mappingResult contains the resposne mapped to a new object. So won't there be two | |
// instances of NSManagedObjectSubclass in my persistent store? | |
} failure:nil]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment