Created
November 28, 2012 11:29
-
-
Save benvium/4160612 to your computer and use it in GitHub Desktop.
Performing a POST in RestKit without all the fiddly object mapping stuff
This file contains hidden or 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
| NSDictionary* dict = @{@"Status": newStatus ? @"On" : @"Off"}; | |
| NSString* url = @"/api/status"; | |
| [[RKClient sharedClient] post:url usingBlock:^(RKRequest *request) { | |
| [request setBody:dict forMIMEType:RKMIMETypeJSON]; | |
| request.onDidLoadResponse = ^(RKResponse* response) { | |
| NSLog(@"status ok %@", response); | |
| if (completion) { | |
| completion(nil); | |
| } | |
| }; | |
| request.onDidFailLoadWithError = ^(NSError* error) { | |
| NSLog(@"status error %@", error); | |
| if (completion) { | |
| completion(error); | |
| } | |
| }; | |
| }]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment