Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8048227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:22:01+00:00 2026-06-05T06:22:01+00:00

I’m having this problem where I get this error on my iPhone: Terminating app

  • 0

I’m having this problem where I get this error on my iPhone:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSConcreteData initWithContentsOfURL:options:error:]: nil URL argument'

I’m trying to parse some XML data, when I try this on the simulator I get no error, but whenever I try it on a iOS device, I get the error in my console!

This is my code to parse the XML:

- (ICB_WeatherConditions *)initWithQuery:(NSString *)query {

if (self = [super init])
{
    CXMLDocument *parser = [[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com/ig/api?weather=%@", query]] options:0 error:nil] autorelease];

    condition         = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/current_conditions/condition" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] retain];        
    location          = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/forecast_information/city" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] retain];
    day2c    = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/forecast_conditions/condition" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] retain];
    day3c     = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/forecast_conditions/condition" error:nil] objectAtIndex:1] attributeForName:@"data"] stringValue] retain];

    currentTemp       = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/current_conditions/temp_f" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] integerValue];
    lowTemp           = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/forecast_conditions[2]/low" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] integerValue];
    highTemp          = [[[[[parser nodesForXPath:@"/xml_api_reply/weather/forecast_conditions/high" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue] integerValue];

    conditionImageURL = [[NSURL URLWithString:[NSString stringWithFormat:@"http://www.google.com%@", [[[[parser nodesForXPath:@"/xml_api_reply/weather/current_conditions/icon" error:nil] objectAtIndex:0] attributeForName:@"data"] stringValue]]] retain];
}

return self;}

and this is my code to send the query:

- (void)showWeatherFor:(NSString *)query {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

ICB_WeatherConditions *weather = [[ICB_WeatherConditions alloc] initWithQuery:query];

self.conditionsImage = [[UIImage imageWithData:[NSData dataWithContentsOfURL:weather.conditionImageURL]] retain];

[self performSelectorOnMainThread:@selector(updateUI:) withObject:weather waitUntilDone:NO];


[pool release];}

Please help point me in the right direction! Thanks again!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T06:22:02+00:00Added an answer on June 5, 2026 at 6:22 am

    I FIGURED IT OUT!

    Okay, so here’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. 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’s reverseGeocodeLocation was 2 words. (i.e Des Moines). The space in the middle messed everything up. Obviously, putting a space in a URL isn’t going to get you any data back. In order to get a space in the “XML spitting service” I was using you had to use a + sign. So after about 4 hours of debugging, I found this out and I put this in:

     stringByReplacingOccurrencesOfString:@" " withString:@"+"
    

    at the end of my method, so in the end it looked like this:

     City = [[placemark locality] stringByReplacingOccurrencesOfString:@" " withString:@"+"];
    

    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!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
I am currently running into a problem where an element is coming back from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.