开发者

EXC_BAD_ACCESS on startAsynchronous request using ASIFormDataRequest

开发者 https://www.devze.com 2022-12-22 21:35 出处:网络
I am getting EXC_BAD_ACCESS on the Line: [asiUsernameRequest startAsynchronous]; in this code.Spent hours trying to figure it out, but no solution.Any idea?

I am getting EXC_BAD_ACCESS on the Line:

[asiUsernameRequest startAsynchronous];

in this code. Spent hours trying to figure it out, but no solution. Any idea?

    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 s开发者_开发百科etPostValue: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];


Try retaining the usernameField's text:

NSString * usernameValue = [[usernameField.text] retain];
0

精彩评论

暂无评论...
验证码 换一张
取 消