POST 데이터를 PHP 웹 사이트에 보내는 코드가 있습니다. 코드 :문제를 일으키는 ASIHTTPRequest
request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com/Testing/Testing.php"]];
[request setPostValue:targettype forKey:@"targettype"];
[request setPostValue:targetmethod forKey:@"targetmethod"];
[request setPostValue:sourceurl forKey:@"sourceurl"];
[request setPostValue:filepath forKey:@"filepath"];
[request setDelegate:self];
[request startAsynchronous];
이것은 완벽하게 작동합니다. 이 데이터를 보내고 PHP 스크립트가 일부 데이터를 출력하면 스크립트는 .txt 파일을 만듭니다. iPhone이 .txt 파일의 내용을 읽으면 ASIHTTPRequest를이 .txt 파일을 삭제해야하는 다른 PHP 스크립트로 실행하려고합니다. PHP가 끝나면 모든 것이 제대로 작동하는 것처럼 보입니다. 그리고 데이터는 iPhone에 의해 완벽하게 수신되고 있습니다. 그러나 일단 데이터가 수신되면 if ... then 문에서 데이터를 확인한 다음 데이터가 있으면 ASIHTTPRequest를 호출하여 .txt를 삭제하려고합니다.
{...
imageView.image = [UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString: string]]];
[self deletefile];
}
-(void) deletefile {
request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:@"http://www.prajoth.com/Testing/Testing.php"]];
[request setPostValue:@"hey" forKey:@"targettype"];
[request setPostValue:@"hey" forKey:@"targetmethod"];
[request setPostValue:@"hey" forKey:@"sourceurl"];
[request setPostValue:filepath forKey:@"filepath"];
[request setDelegate:self];
[request startAsynchronous];
}
이 어떤 이유있는 EXC_BAD_ACCESS을 던지고 : 이것은 내가 새로운 PHP 위치에 데이터를 게시하는 데 사용되는 코드입니다. 콘솔에 오류 메시지가 표시되지 않습니다. 도와주세요!
표준 iOS 디버깅 기술이 적용됩니다. EXC_BAD_ACCESS 용 디버거에서 스택 트레이스를 게시하고 NSZombies를 사용하여 실행 해보십시오. – JosephH