检查iphone中的web身份验证服务

检查iphone中的web身份验证服务,iphone,objective-c,Iphone,Objective C,朋友 我试了这么多,但没有得到任何解决办法 若他或她输入他们的用户名和密码,那个么我希望从webserver数据库中获取这些值。 如果他的用户名和密码在那里很多,那么他将使用该应用程序。 除此之外,他没有使用此应用程序的权限。请查看,其中包括用于基本HTTP身份验证的简单方法。请查看,其中包括用于基本HTTP身份验证的简单方法。您可以尝试以下代码:- NSString *post = [NSString stringWithFormat:@"Loginkey=%@&Passwor

朋友 我试了这么多,但没有得到任何解决办法 若他或她输入他们的用户名和密码,那个么我希望从webserver数据库中获取这些值。 如果他的用户名和密码在那里很多,那么他将使用该应用程序。
除此之外,他没有使用此应用程序的权限。

请查看,其中包括用于基本HTTP身份验证的简单方法。

请查看,其中包括用于基本HTTP身份验证的简单方法。

您可以尝试以下代码:-

    NSString *post = [NSString stringWithFormat:@"Loginkey=%@&Password=%@&DeviceCode=%@&Firmware=%@&IMEI=%@",txtUserName.text,txtPassword.text,model,sysver,udid];
    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; 
    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; 
    NSLog(@"%@",postLength);
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; 
    [request setURL:[NSURL URLWithString:@"http://191.16.0.6:91/JourneyMapperAPI?RequestType=Login"]]; //add your web service url here
    [request setHTTPMethod:@"POST"]; 
    [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; 
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 
    [request setHTTPBody:postData];

您可以尝试以下代码:-

    NSString *post = [NSString stringWithFormat:@"Loginkey=%@&Password=%@&DeviceCode=%@&Firmware=%@&IMEI=%@",txtUserName.text,txtPassword.text,model,sysver,udid];
    NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; 
    NSString *postLength = [NSString stringWithFormat:@"%d", [postData length]]; 
    NSLog(@"%@",postLength);
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease]; 
    [request setURL:[NSURL URLWithString:@"http://191.16.0.6:91/JourneyMapperAPI?RequestType=Login"]]; //add your web service url here
    [request setHTTPMethod:@"POST"]; 
    [request setValue:postLength forHTTPHeaderField:@"Content-Length"]; 
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; 
    [request setHTTPBody:postData];

你有用于身份验证的web服务吗?是的,我有用于身份验证的web服务我不知道该做什么你有用于身份验证的web服务吗?是的,我有用于身份验证的web服务我不知道该做什么