0

我要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];
4

1 回答 1

0

尝试保留usernameField's text

NSString * usernameValue = [[usernameField.text] retain];
于 2010-09-16T00:53:38.420 回答