Hi,
I'm wondering why this http post request won't work for my iphone app.
I know for a fact that the url is correct and that the variables I'm sending are correct but for some reason the request is not being recieved by the aspx page.
EDIT::
I re factored the code into its own class with its own delegate methods. The delegate methods do not get called though
The class is called like so
URLCallClass *reporter=[[[URLCallClass alloc] init]autorelease];
[reporter sendoview:@"http://mysite/page.aspx" params:httpBodyString];
And this is the actual class itself
-(void)sendview:(NSString *)server params:(NSString *)params
{
NSURL* url=[[NSURL alloc] initWithString:server];
NSMutableURLRequest *urlRequest=[NSMutableURLRequest requestWithURL:url];
[url release];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setHTTPBody:[params dataUsingEncoding:NSUTF8StringEncoding]];
connectionResponse=[[[NSURLConnection alloc] initWithRequest:urlRequest delegate:self] autorelease];
//NSURLConnection *connectionResponse = [[NSURLConnection alloc] initWithRequest:urlRequest delegate:self];
if (!connectionResponse)
{
NSLog(@"Failed to submit request");
}
else
{
NSLog(@"---------Report Request submitted ---------");
}
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
NSLog(@"report received response");
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
NSLog(@"report failed with error");
NSLog(@"%@", [error description]);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSLog(@"Promo View Reported");
}
-(void)dealloc
{
[connectionResponse release];
[super dealloc];
}