Created
July 29, 2011 16:18
-
-
Save blakewatters/1114150 to your computer and use it in GitHub Desktop.
Attach an Image to an Object Loader
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
[[RKObjectManager sharedManager] postObject:contact delegate:self block:^(RKObjectLoader* loader) { | |
RKObjectMapping* serializationMapping = [[[RKObjectManager sharedManager] mappingProvider] serializationMappingForClass:[Contact class]]; | |
NSError* error = nil; | |
NSDictionary* dictionary = [[RKObjectSerializer serializerWithObject:contact mapping:serializationMapping] serializedObject:&error]; | |
RKParams* params = [RKParams paramsWithDictionary:dictionary]; | |
[params setData:[contact avatarImageData] MIMEType:@"image/png" forParam:@"avatar_image"]; | |
loader.params = params; | |
}]; |
forParams:@"avatar_image"
should read
forParam:@"avatar_image"
(without the s)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Should be