ログイン資格情報を確認するために 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!
誰でもこれで私を助けることができますか?
敬具