{"id":3838,"date":"2014-03-30T05:59:28","date_gmt":"2014-03-30T05:59:28","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/getting-argument-exception-nil-url-argument-collection-of-common-programming-errors\/"},"modified":"2014-03-30T05:59:28","modified_gmt":"2014-03-30T05:59:28","slug":"getting-argument-exception-nil-url-argument-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/getting-argument-exception-nil-url-argument-collection-of-common-programming-errors\/","title":{"rendered":"Getting Argument Exception (nil URL argument)!-Collection of common programming errors"},"content":{"rendered":"<p>I FIGURED IT OUT!<\/p>\n<p>Okay, so here&#8217;s the story and solution: I was making a weather app, and the query needed a city in-order to get a valid XML file with data. In my simulator, the location was WAY off, so it put me in Glendale, CA?! As you can see <strong>Glendale is ONE WORD<\/strong>. So when this went into the query, it passed as a valid URL, and got data. When I went on my phone to test it out, I got the error stated above! This was because where I live, the city name retrieved from CLGeocoder&#8217;s reverseGeocodeLocation was 2 words. (i.e Des Moines). The <strong>space in the middle<\/strong> messed everything up. Obviously, putting a space in a URL isn&#8217;t going to get you any data back. In order to get a space in the &#8220;XML spitting service&#8221; I was using you had to use <strong>a + sign<\/strong>. So after about 4 hours of debugging, I found this out and I put this in:<\/p>\n<pre><code> stringByReplacingOccurrencesOfString:@\" \" withString:@\"+\"\n<\/code><\/pre>\n<p>at the end of my method, so in the end it looked like this:<\/p>\n<pre><code> City = [[placemark locality] stringByReplacingOccurrencesOfString:@\" \" withString:@\"+\"];\n<\/code><\/pre>\n<p>This solved it, and now spaces could be replaced with the plus signs, therefore giving me actual data back! Good Luck to anyone who has a similar problem!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I FIGURED IT OUT! Okay, so here&#8217;s the story and solution: I was making a weather app, and the query needed a city in-order to get a valid XML file with data. In my simulator, the location was WAY off, so it put me in Glendale, CA?! As you can see Glendale is ONE WORD. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3838","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3838","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3838"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3838\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3838"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3838"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3838"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}