iphone - Trying to put user input in yahoo api URL -


i trying learn ios , first project make app displays weather forecast in area of zip code user enters.

i have url is:

nsstring *zipurl = @"http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3d%2289448%22&format=json"; 

the zip code near end after 3d%22:

3d%22*89448*%22

i need figure out how insert user entered in text box spot. have tried [nsstring stringwithformat] there many % signs doesn't work.

please let me know if need more info.

you need decode zipurl first because encoded string.

nsstring *zipurl = @"http://query.yahooapis.com/v1/public/yql?q=select%20item%20from%20weather.forecast%20where%20location%3d%2289448%22&format=json";      nsstring *decodedstring= [[nsstring stringwithformat:@"%@",zipurl] stringbyreplacingpercentescapesusingencoding:nsutf8stringencoding];     nslog(@"decodedstring : %@",decodedstring);      nsstring *mystringurl = [nsstring stringwithformat:@"http://query.yahooapis.com/v1/public/yql?q=select item weather.forecast location=%@&format=json",yourtextfield.text]; 

hope helps you.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -