它可能很容易,但我似乎没有找到为什么URLWithString:
返回零这里。URLWithString:返回零
//localisationName is a arbitrary string here
NSString* webName = [localisationName stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
NSString* stringURL = [NSString stringWithFormat:@"http://maps.google.com/maps/geo?q=%@,Montréal,Communauté-Urbaine-de-Montréal,Québec,Canadae&output=csv&oe=utf8&sensor=false&key=", webName];
NSURL* url = [NSURL URLWithString:stringURL];
是什么在调用'stringWithFormat:'之前'webName'的值? 然后,在调用'URLWithString:'之前'stringURL'的值是多少? 使用'NSLog()'将它们一步一步地打印出来,或者设置断点并检查它们设置的值。 – 2009-12-30 17:38:30