Bad URL when requesting with NSURL

此生再无相见时 提交于 2019-11-27 09:07:09
 NSString *strURL = [loc_address stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];

            // requesting weather for this location ... 
            NSMutableURLRequest *req = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:[NSString stringWithFormat: @"http://www.google.com/ig/api?weather=%@", strURL]] cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:5.0];
            [req setHTTPMethod:@"POST"];
            [req addValue:@"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];

You need to replace the pipe character in the URL with %7C. This is the URL encoded value.

Also, the URL needs to be enclosed in quotation marks in order for it to work with curl.

ho ho ho.

Set location_id using the id of the venue you want.

This make me waste a lot of time.

One of dozen facebook secrets is debug network when making what you want, in this case creating a event. You'll see the correct params names for what you need.

This error message, also can be caused by any error in the URL typing. Usually some white space in the URL string.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!