在我们的开发团队中,我们实施了一项WEB服务,该服务将对客户进行身份验证。 从iPhone应用程序我们需要将客户端的信息发送到Web服务,为此,我编写了以下函数。
-(void)authenticateClient:(NSString*)theContractNumber
ClientCode:(NSString*)theClientCode
CellPhone:(NSString*)theCellPhone
appleID:(NSString*)theAppleID
{
NSLog(@"Begin Send the information to the Web Service",nil);
NSString *uid = [UIDevice currentDevice].uniqueIdentifier;
NSDictionary *formParams = [NSDictionary dictionaryWithObjectsAndKeys:
theClientCode, @"ClientCode",
theContractNumber, @"ContractCode",
theAppleID, @"AppleID",
@" ", @"AndroidID",
@" ", @"WindowsID",
uid, @"AppleDeviceID",
@" ", @"AndroidDeviceID",
@" ", @"WindowsDeviceID",
theCellPhone, @"TelephoneNumber"
, nil];
MKNetworkOperation *operation = [self.engine operationWithPath:@"/services/Authentication.ashx"
params: formParams
httpMethod:@"POST"];
[operation addCompletionHandler:
^(MKNetworkOperation *operation) {
NSLog(@"%@", [operation responseString]);
}
errorHandler:^(MKNetworkOperation *errorOperation, NSError *error) {
NSLog(@"%@", error);
}];
[self.engine enqueueOperation:operation] ;
}
该功能有效(或似乎没有错误),但实际上它没有做任何事情。它从 [operation addCompletionHandler:块传递,但它没有做任何事情。我也一步一步地执行它,我再次看到应用程序到达这一行,然后执行它并直接转到 [self.engine enqueueOperation:operation] 行而不进入代码块。
有人可以提供帮助吗?
谢谢。