关于ASIHTTPRequest发送请求

jxd*_*ter 1 asihttprequest ios

我正在使用ASIHTTPRequest [request startAsynchronous]functon向我的webservice api发送请求以登录.如果请求正常,则返回json值.然后我发送另一个请求来获取用户的信息,但在这里我收到一个错误.

这是我的代码:

-(void)login
{
    [usernameTextField resignFirstResponder];
    [passwordTextField resignFirstResponder];

    username = [usernameTextField text];
    password = [passwordTextField text];

    if ( ([username length] == 0 ) || ([password length] == 0 )) 
    {
       ...
    }
    else
    {
        NSString *URL = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/Login?user=%@&pass=%@",username,password];
        NSURL *requestURL = [NSURL URLWithString:URL];
        ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:requestURL];
        [request setValidatesSecureCertificate:NO];
        [request setDelegate:self];
        [request startAsynchronous];
    }
}

- (void)requestFinished:(ASIHTTPRequest *)request
{
    NSError *error = [request error];
    if (!error) 
    {
        NSString *responseString = [request responseString];
        NSDictionary *responseDict = [responseString JSONValue];
        NSString *unlockCode = [responseDict objectForKey:@"d"];
        if ( [unlockCode isEqualToString:@"successful"] ) 
        {
            NSURL *url = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/GetUserInfo?user=%@",username];
            ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
            [request setValidatesSecureCertificate:NO];
            [request startSynchronous];**//THERE IS AN ERROR**
            NSError *error = [request error];
            if (!error) 
            {
                NSDictionary *responseDict = [responseString JSONValue];
                NSString *realName = [responseDict objectForKey:@"RealName"];
                NSLog(@"%@",realName);
            } 
        }
        else
        {
           //...
        }
    }
    else
    {
        NSLog(@"%@",[error description]);
    }
}
Run Code Online (Sandbox Code Playgroud)

并且有一个错误:

[__NSCFString absoluteURL]:无法识别的选择器发送到实例0x69ef4b0

另一个错误:

void SendDelegateMessage(NSInvocation*):委托(_selectionLayoutChangedByScrolling :)等待10秒后无法返回.主运行循环模式:kCFRunLoopDefaultMode

Fel*_*lix 7

这行不正确:

    NSURL *url = [NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/GetUserInfo?user=%@",username];
Run Code Online (Sandbox Code Playgroud)

它应该改为:

    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://xxx.xxx.xx.xx/FMS/Pages/Service/FMService.svc/GetUserInfo?user=%@",username]];
Run Code Online (Sandbox Code Playgroud)