I have a code that sends POST data to a PHP website. Code:
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];
This is working perfectly. Once this data is sent and the PHP script outputs some data, the script creates a .txt file. Once the iPhone reads the contents of the .txt file, I want to run ASIHTTPRequest to a different PHP script that is supposed to delete this .txt file. From a PHP end, everything seems to be working, and the data is being received perfectly by the iPhone. However, once the data is received, I have a if...then statement that checks for the data and then once the data is present, I want to call ASIHTTPRequest to delete the .txt. This is the code I used to POST the data to the new PHP location:
{...
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];
}
This is for some reason, throwing up a EXC_BAD_ACCESS. The console does not show any error message though. Please help!
Based on the code you've pasted, it's going to be difficult to figure this out. Where exactly is your app throwing the exception? It could be perhaps one of your global variables doesn't exist any more (filepath
, for example), but then again it could also be something elsewhere in your code. EXC_BAD_ACCESS
messages, as you can probably guess, occur when you try to access an object that's no longer in memory, so maybe you are releasing something earlier on which you now rely on?