I have tried some StackOverflow questions and am going to find the right answer to this. I am using the POSTMAN plugin for Chrome to test my REST calls, and I cannot understand why I cannot read the answer. In the comments, you will see all the various attempts I made to get an answer.
NSDictionary* session_params = @{SESSION_USERNAME_KEY:SESSION_USERNAME_VALUE, SESSION_PASSWORD_KEY:SESSION_PASSWORD_VALUE};
NSURL* url = [NSURL URLWithString:SESSION_URL];
RKObjectManager* objectManager = [RKObjectManager managerWithBaseURL:url];
NSMutableURLRequest* request = [objectManager requestWithObject:nil method:RKRequestMethodPOST path:SESSION_URL parameters:session_params];
RKObjectRequestOperation* operation = [objectManager
objectRequestOperationWithRequest:request success:^(RKObjectRequestOperation* operation, RKMappingResult* result)
{
NSLog(@"RESULT [%@]", result);
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"ERROR [%@]", error);
}];
[operation start];
I think the most annoying is that the material I need is contained in the NSLocalizedRecoverySuggestion value. This is the session key I need.
CONCLUSION:
E restkit.network:RKObjectRequestOperation.m:547 : HTTP- : Error Domain = org.restkit.RestKit.ErrorDomain Code = -1016 " {( " /-WWW--urlencoded ", " /JSON ")}, /html " UserInfo = 0x1c52aed0 {NSLocalizedRecoverySuggestion = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCbG8uUmVnQWxlcnQuQnJva2VyIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdC9CbG8uUmVnQWxlcnQuQVBJL2FwaSIsIm5iZiI6MTM5MjY0MTY2MSwiZXhwIjoxMzkyNjQ1MjYxLCJ1bmlxdWVfbmFtZSI6IkJ1dHRvbnMiLCJyb2xlIjoiUmVnQWxlcnRDb25zdW1lciJ9.JCTMGJRKlOxEtNrcGodpce-tqsRS4zlApNisKQW6iSw, AFNetworkingOperationFailingURLRequestErrorKey =, NSErrorFailingURLKey = HTTP://..., NSLocalizedDescription = {( "/-WWW--urlencoded ", " /JSON " )}, /html, AFNetworkingOperationFailingURLResponseErrorKey =} 2014-02-17 14: 54: 20.808 AppName [5600: 6403] E restkit.network:RKObjectRequestOperation.m:213 POST 'http://...' (200 OK/0 ) [request = 0.0000s mapping = 0.0000s total = 0.1925s]: Error Domain = org.restkit.RestKit.ErrorDomain Code = -1016 " {( " /-WWW--urlencoded ", " /JSON ")}, /html " UserInfo = 0x1c52aed0 {NSLocalizedRecoverySuggestion = eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJCbG8uUmVnQWxlcnQuQnJva2VyIiwiYXVkIjoiaHR0cDovL2xvY2FsaG9zdC9CbG8uUmVnQWxlcnQuQVBJL2FwaSIsIm5iZiI6MTM5MjY0MTY2MSwiZXhwIjoxMzkyNjQ1MjYxLCJ1bmlxdWVfbmFtZSI6IkJ1dHRvbnMiLCJyb2xlIjoiUmVnQWxlcnRDb25zdW1lciJ9.JCTMGJRKlOxEtNrcGodpce-tqsRS4zlApNisKQW6iSw, AFNetworkingOperationFailingURLRequestErrorKey =, NSErrorFailingURLKey = HTTP://..., NSLocalizedDescription = {( "/-WWW--urlencoded ", " /JSON " )}, /html, AFNetworkingOperationFailingURLResponseErrorKey =}
,
, . , RestKit , RestKit, , , , :
NSDictionary* session_params = @{SESSION_USERNAME_KEY:SESSION_USERNAME_VALUE, SESSION_PASSWORD_KEY:SESSION_PASSWORD_VALUE};
NSURL* url = [NSURL URLWithString:SESSION_URL];
AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:url];
NSMutableURLRequest *request = [httpClient requestWithMethod:@"POST" path:SESSION_URL parameters:session_params];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSString* response = [operation responseString];
NSLog(@"response: %@",response);
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
NSLog(@"error: %@", [operation error]);
}];
[operation start];