我在使用ASIFormDataRequest
. 该请求似乎已发出,但是当我在完成后尝试访问该请求时出现EXC_BAD_ACCESS
错误。环顾四周后,我看不出我在做什么,因此我转向这里。谁能发现我做错了什么?
我在这里得到了代码的基础知识。
- (void)viewDidLoad
{
/* Stuff here */
NSURL *url = [NSURL URLWithString:@"http://www.mysite.com/login"];
ASIFormDataRequest *request1 = [ASIFormDataRequest requestWithURL:url];
[request1 setPostValue:@"email@email.com" forKey:@"email"];
[request1 setPostValue:@"pass123" forKey:@"password"];
[request1 setDelegate:self];
[request1 startAsynchronous];
}
- (void)requestFinished:(ASIHTTPRequest *)thisRequest
{
NSLog(@"Request FInished: %@", thisRequest.responseStatusCode); //crashes here
if (thisRequest.responseStatusCode == 403){
NSLog(@"403 Not authorised");
}
if (thisRequest.responseStatusCode == 200)
{
NSLog(@"Data: %@", thisRequest.responseString);
}
}