使用ASIFormDataRequest在startAsynchronous请求上的EXC_BAD_ACCESS

时间:2010-03-16 11:22:07

标签: iphone asynchronous exc-bad-access

我在线上获得EXC_BAD_ACCESS

[asiUsernameRequest startAsynchronous];

在此代码中。花了几个小时试图解决它,但没有解决方案。有什么想法吗?

    NSString *usernameValue = (NSString*)usernameField.text;
    NSLog(@"username selected: %@", usernameValue);

    NSURL *url = [NSURL URLWithString:@"http://www.mywebsite.com/api/usernameCheck"];
    //ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
    asiUsernameRequest = [[[ASIFormDataRequest alloc] initWithURL:url] retain];
    [asiUsernameRequest setPostValue:usernameValue forKey:@"username"];
    NSArray *objects = [NSArray arrayWithObjects:@"usernameCheck", nil];
    NSArray *keys = [NSArray arrayWithObjects:@"action", nil];
    asiUsernameRequest.userInfo = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
    [asiUsernameRequest setDelegate:self];
    [asiUsernameRequest startAsynchronous];

1 个答案:

答案 0 :(得分:0)

尝试保留usernameField的{​​{1}}:

text