2014-10-29 15:20:20.897 MyProject[2487:4507] *** Assertion failure in -[RKEntityByAttributeCache addObjects:completion:], /Users/jrogoff/Desktop/MyProject/Pods/RestKit/Code/CoreData/RKEntityByAttributeCache.m:333
2014-10-29 15:20:20.900 MyProject[2487:4507] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Cannot add object with entity 'TestResult' to cache for entity of 'TestResult''
NSMutableURLRequest *request = [[RKObjectManager sharedManager]
multipartFormRequestWithObject:testResult
method:RKRequestMethodPOST path:path parameters:nil
constructingBodyWithBlock:^(id<AFMultipartFormData> formData) {
[formData appendPartWithFileData:UIImagePNGRepresentation(testResult.capturedImage)
name:@"imageFileData"
fileName:@"photo.png"
mimeType:@"image/png"];
}];
RKObjectRequestOperation *operation = [[RKObjectManager sharedManager]
managedObjectRequestOperationWithRequest:request
managedObjectContext:context
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
NSLog(@"Successfully uploaded testResult %@", testResult);
TestResult *nextTest = mappingResult.firstObject;
//Perform business logic for next test here
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"Unable to upload testResult: %@", error);
}];
[[RKObjectManager sharedManager] enqueueObjectRequestOperation:operation];