문제

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..

도움이 되었습니까?

해결책

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.
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top