Pergunta

I'm trying to parse xml but I have a problem:

NSString *url = [NSString stringWithFormat:@"http://ipadress/web_service/list.php?DATE=%@",dateSinc];
NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:url]];
[request setHTTPMethod:@"GET"];

NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
if (conn) {
    webData = [[NSMutableData data] retain];
}
else{

}

when the dateSinc is 2013-02-04 example it works but when is 2013-02-04 09:47:00 it doesn't work(the connection not respond)... but in browser works..

Foi útil?

Solução

I think the issue relates to not properly encoding the URL, so the web server isn't seeing the date you want:

NSString *url = [NSString stringWithFormat:@"http://ipadress/web_service/list.php?DATE=%@",dateSinc];
NSString *encodedURL = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSMutableURLRequest *request =[[[NSMutableURLRequest alloc] init] autorelease];
[request setURL:[NSURL URLWithString:encodedURL]];
// etc.
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top