Created
January 17, 2015 08:31
-
-
Save kitasuke/38f83e53a4fbb391c2be to your computer and use it in GitHub Desktop.
Object Mapping with RestKit not using URL connection
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
NSHTTPURLResponse *httpurlResponse = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"/hoge/"] | |
statusCode:200 | |
HTTPVersion:nil | |
headerFields:@{}]; | |
RKResponseMapperOperation *responseMapperOperation = [[RKResponseMapperOperation alloc] initWithRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"/hoge/"]] | |
response:httpurlResponse | |
data:[NSData new] | |
responseDescriptors:@[ | |
[RKResponseDescriptor responseDescriptorWithMapping:responseMapping | |
method:RKRequestMethodGET | |
pathPattern:@"/hoge/" | |
keyPath:nil | |
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)] | |
]]; | |
RKMapperOperation *mapperOperation = [[RKMapperOperation alloc] initWithRepresentation:@{@"key": @"value"} | |
mappingsDictionary:responseMapperOperation.responseMappingsDictionary]; | |
[mapperOperation start]; | |
id object = [mapperOperation.mappingResult.array firstObject]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment