Your problem is that you've got three instances of XMLParser
where you could be setting the instance variable:
- Local
NSXMLParser *parser
allocated insideparseXMLAtURL:
, - Function-static
static XMLParser *XMLStore
allocated insidesharedStore
, and - Instance variable
XMLParser *XMLStore;
which you never allocate, so it staysnil
.
It is the third instance on which you try calling your setters. Since it's nil
, the calls have no effect: [XMLStore setLongitudeValue:...]
does nothing.
To fix this, drop the second and the third variables, along with the +(XMLParser *)sharedStore
method. Use the regular instance properties, rather than accessing the shared one.
You can harvest the results from the local parser
variable upon completion of the [parser parse]
call:
NSLog(@"Long:%@, Lat:%@", parser.longitudeValue, parser.latitudeValue);