我有一个 restkit 函数,我调用一个 web 服务来检查我的登录凭据。在这次通话中,我将我的电子邮件和密码作为参数。在这里你可以看到代码。
RKObjectManager *manager = [RKObjectManager managerWithBaseURL:[NSURL URLWithString:@"http://****.com/nl/webservice/"]];
NSDictionary *dictionary = [[NSDictionary alloc]initWithObjectsAndKeys:_txtLogin.text,@"email",_txtPass.text,@"pwd", nil];
NSLog(@"till here");
NSMutableURLRequest *request = [manager requestWithObject:nil method:RKRequestMethodPOST path:@"company-user/login/apikey/key*****?" parameters:dictionary];
NSLog(@"till here2");
RKObjectRequestOperation *operation = [manager objectRequestOperationWithRequest:request success:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
NSLog(@"till here3");
NSLog(@"Loading mapping result: %@", result);
}failure:^(RKObjectRequestOperation *operation, NSError *error){
//Failure
NSLog(@"error is:%@ ",error);
NSLog(@"FAILUREE!");
}];
NSLog(@"till here4");
[operation start];
NSLog(@"till here5");
但由于某种原因,我去了失败的部分。它首先给了我一个状态 200,然后是一个错误。你可以在这里看到我的日志。
2013-01-07 20:33:45.858 Offitel2[26195:c07] till here
2013-01-07 20:33:45.859 Offitel2[26195:c07] till here2
2013-01-07 20:33:45.860 Offitel2[26195:c07] till here4
2013-01-07 20:33:47.252 Offitel2[26195:c07] till here5
2013-01-07 20:33:47.254 Offitel2[26195:c07] I restkit.network:RKHTTPRequestOperation.m:152 POST 'http://virtuele-receptie.preview.sanmax.be/nl/webservice/company-user/login/apikey/key12345678?'
2013-01-07 20:33:47.255 Offitel2[26195:c07] I restkit.network:RKHTTPRequestOperation.m:179 POST 'http://virtuele-receptie.preview.sanmax.be/nl/webservice/company-user/login/apikey/key12345678?' (200 OK) [0.0005 s]
2013-01-07 20:33:47.255 Offitel2[26195:c07] error is:Error Domain=org.restkit.RestKit.ErrorDomain Code=1001 "No response descriptors match the response loaded." UserInfo=0xa869130 {NSErrorFailingURLStringKey=http://virtuele-receptie.preview.sanmax.be/nl/webservice/company-user/login/apikey/key12345678?, NSLocalizedFailureReason=A 200 response was loaded from the URL 'http://virtuele-receptie.preview.sanmax.be/nl/webservice/company-user/login/apikey/key12345678?', which failed to match all (0) response descriptors:, NSLocalizedDescription=No response descriptors match the response loaded., keyPath=null, NSErrorFailingURLKey=http://virtuele-receptie.preview.sanmax.be/nl/webservice/company-user/login/apikey/key12345678?, NSUnderlyingError=0xa8695b0 "No mappable object representations were found at the key paths searched."}
2013-01-07 20:33:47.256 Offitel2[26195:c07] FAILUREE!
有人可以帮我吗?
亲切的问候