1
votes

I am new to restkit.I have integrated restkit 0.20.0-pre6 successfully by following instructions from github. Then I have build my project in console, I got the following

restkit:RKLog.m:34 RestKit logging initialized...

after that I would like to get data at a path

Initially there is an activation screen .so I would like to send activation code to it and if it is correct, I would like to get corresponding details .

NSURL *urll=[NSURL URLWithString:@"http://url/FirstRest/rest/application/Activate"];
AFHTTPClient* client = [[AFHTTPClient alloc] initWithBaseURL:urll];
RKObjectManager *manager = [[RKObjectManager alloc] initWithHTTPClient:client];
[RKObjectManager setSharedManager:manager];



Article *article = [Article new];
article.activationCode = @"S1234";
[manager.router.routeSet addRoute:[RKRoute routeWithClass:[Article class] pathPattern:@"/FirstRest/rest/application/Activate/:activationCode" method:RKRequestMethodGET]];

[[RKObjectManager sharedManager] getObject:article path:nil parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *result)
{
    // Request
    NSLog(@"result is ************* %@",result);
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
                       UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                      [alert show];
}];

`

in my console I'm getting

   I restkit.network:RKHTTPRequestOperation.m:179 GET 'http://url/FirstRest/rest/application/Activate/S1234' (200 OK) [1.4744 s]

2013-01-28 14:07:59.284 Polls[985:15103] E restkit.network:RKResponseMapperOperation.m:240 Failed to parse response data: Loaded an unprocessable response (200) with content type 'application/json'

I couldn't find out what does it really means and how to overcome this

1
It would help if you added the server response for this request.Alex
E restkit.network:RKResponseMapperOperation.m:240 Failed to parse response data: Loaded an unprocessable response (200) with content type 'application/json' in consoleram880
I mean the actual server response, i.e., the JSON.Alex

1 Answers

0
votes

The JSON you are getting as a response is probably malformed.

I've encoutered a similar situation and checked out the actual error object (CMD+SHIFT+F for "Failed to parse response", you'll find the lines).

After print description of the error, I found the JSON I was getting had duplicate keys, therefore was not parseable (altough most browsers / json viewers just ignored it).