0

在我们的开发团队中,我们实现了一个 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]行而不进入代码块。

有人可以帮忙吗?

谢谢你。

4

0 回答 0