I got an app that shows current location on some labels. In viewDidLoad I call [gps startUpdatingLocation]; (instance of CLLocationManager), so gps calls the relative method:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
//NSLog(#"didUpdateToLocation: %#", newLocation);
currentLocation = newLocation;
if (currentLocation != nil) {
longitude.text = [NSString stringWithFormat:#"%.3f", currentLocation.coordinate.longitude];
latitude.text = [NSString stringWithFormat:#"%.3f", currentLocation.coordinate.latitude];
}
NSLog(#"Resolving the Address");
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(#"Found placemarks: %#, error: %#", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
[address sizeToFit];
address.text = [NSString stringWithFormat:#"%#, %#\n%# %#\n%#",
[self sanitizedDescription:placemark.thoroughfare],
[self sanitizedDescription:placemark.subThoroughfare],
[self sanitizedDescription:placemark.postalCode],
[self sanitizedDescription:placemark.locality],
[self sanitizedDescription:placemark.country]];
if (address.text != NULL)
{
[gps stopUpdatingLocation];
}
} else {
NSLog(#"%#", error.debugDescription);
}
} ];
}
So when the address is obtained, gps must stopUpdatingLocation. All works fine, but in-app address label is still empty! Why?
P.S.: sanitizedDescription is a simple method that returns "..." if a placemark.value is nil:
- (id)sanitizedDescription:(NSString *)obj
{
if (obj == nil)
{
obj = #"...";
return obj;
}
return obj;
}
Problem solved, address label was too small, so I simply called [address sizeToFit] again in the if cycle:
if (address.text != NULL)
{
[address sizeToFit];
[gps stopUpdatingLocation];
}
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I've got myself some of a newbie problem.
I got this method to determine the zip code where the iPhone is located, based on GPS coordinates. Reverse Geocoding. My method works, I know this, since it has no problem writing out the correct zip code to a label.
But I need this zip code to be stored in a string that I can use inside a method I use to compose a SMS.
Anyone can help me with that?
Tell me if an source code is necessary! (Just not currently sitting on my work comp)
Clearly i've been misunderstood, should have posted som code.
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSLog(#"didUpdateToLocation: %#", newLocation);
CLLocation *currentLocation = newLocation;
// Reverse Geocoding
NSLog(#"Resolving the Address");
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(#"Found placemarks: %#, error: %#", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
**postalCode** = [NSString stringWithFormat:#"%#",
placemark.postalCode];
} else {
NSLog(#"%#", error.debugDescription);
}
} ];
}
Here i try to save the zip code inside the NSString named postalCode (highlighted with "**")
I try to load it again in sms composer
-(void)displaySMSComposerSheet
{
CLLocation *currentLocation;
// Reverse Geocoding
NSLog(#"Resolving the Address");
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
NSLog(#"Found placemarks: %#, error: %#", placemarks, error);
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
postalCode = [NSString stringWithFormat:#"%#",
placemark.postalCode];
} else {
NSLog(#"%#", error.debugDescription);
}
} ];
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.recipients = [NSArray arrayWithObjects:#"1220", nil];
picker.body = [NSString stringWithFormat:#"Dog %#", (placemark.)postalCode];
picker.messageComposeDelegate = self;
[self presentModalViewController:picker animated:YES];
}
only prints out in the SMS window:
Dog (null)
And i'm sure i have the coordinates, they get printed out in the output.
Hope this helps to understand the question better
#import <CoreLocation/CoreLocation.h>
#interface SomeController : UIViewController <CLLocationManagerDelegate>
#property (strong,nonatomic) CLLocationManager *locationManager;
#end
#implementation SomeController
-(void) trackUpdates
{
self.locationManager = [CLLocationManager new];
self.locationManager.delegate = self;
self.locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
self.locationManager.distanceFilter = 10.0f;
if ([CLLocationManager locationServicesEnabled]){
[self.locationManager startUpdatingLocation];
}
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateLocations:(NSArray *)locations
{
CLGeocoder* gcrev = [[CLGeocoder alloc] init];
[gcrev reverseGeocodeLocation:[locations lastObject]
completionHandler:^(NSArray *placemarks, NSError *error)
{
CLPlacemark* revMark = [placemarks objectAtIndex:0];
NSString *zip = [revMark.addressDictionary objectForKey:#"ZIP"];
NSLog(#"%#",zip);
// ... do something with the zip, store in an ivar, call a method, etc.
}];
}
-(void)viewDidLoad {
[super viewDidLoad];
[self trackUpdates];
}
#end
I am trying to get the current city and country using CLLocationManager with below code -
#pragma mark - Core Location Delegate Methods
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init];
[reverseGeocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error)
{
NSLog(#"reverseGeocodeLocation:completionHandler: Completion Handler called!");
if (error){
NSLog(#"Geocode failed with error: %#", error);
return;
}
NSLog(#"Received placemarks: %#", placemarks);
CLPlacemark *myPlacemark = [placemarks objectAtIndex:0];
NSString *countryCode = myPlacemark.ISOcountryCode;
NSString *countryName = myPlacemark.country;
NSString *city1 = myPlacemark.subLocality;
NSString *city2 = myPlacemark.locality;
NSLog(#"My country code: %#, countryName: %#, city1: %#, city2: %#", countryCode, countryName, city1, city2);
}];
}
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading
{
CLLocationDirection th=[newHeading trueHeading];
NSLog(#"True Heading value is=%f",th);
CLLocationDirection magnetic=[newHeading magneticHeading];
NSLog(#"Magnetic Heading value is=%f",magnetic);
}
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error
{
NSString *errorType = (error.code == kCLErrorDenied) ? NSLocalizedString(#"access_denied", #"") : NSLocalizedString(#"unknown_error", #"");
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:NSLocalizedString(#"error_getting_location", #"")
message:errorType
delegate:nil
cancelButtonTitle:NSLocalizedString(#"ok", #"")
otherButtonTitles:nil];
[alert show];
}
It always gives the result with -
My country code: IN, countryName: India, city1: (null), city2: (null)
I don't know what may be the issue for this. Has anyone faced this issue that can't able to get the city name using CLLocationManager
EDITED:
- (void) getReverseGeocode
{
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
if(currentLatLong.count > 0)
{
CLLocationCoordinate2D myCoOrdinate;
myCoOrdinate.latitude = LatValue;
myCoOrdinate.longitude = LangValue;
CLLocation *location = [[CLLocation alloc] initWithLatitude:myCoOrdinate.latitude longitude:myCoOrdinate.longitude];
[geocoder reverseGeocodeLocation:location completionHandler:^(NSArray *placemarks, NSError *error)
{
if (error)
{
NSLog(#"failed with error: %#", error);
return;
}
if(placemarks.count > 0)
{
NSString *MyAddress = #"";
NSString *city = #"";
if([placemark.addressDictionary objectForKey:#"FormattedAddressLines"] != NULL)
MyAddress = [[placemark.addressDictionary objectForKey:#"FormattedAddressLines"] componentsJoinedByString:#", "];
else
MyAddress = #"Address Not founded";
if([placemark.addressDictionary objectForKey:#"SubAdministrativeArea"] != NULL)
city = [placemark.addressDictionary objectForKey:#"SubAdministrativeArea"];
else if([placemark.addressDictionary objectForKey:#"City"] != NULL)
city = [placemark.addressDictionary objectForKey:#"City"];
else if([placemark.addressDictionary objectForKey:#"Country"] != NULL)
city = [placemark.addressDictionary objectForKey:#"Country"];
else
city = #"City Not founded";
NSLog(#"%#",city);
NSLog(#"%#", MyAddress);
}
}];
}
}
You know about the apple maps and there database for the location, better try with google places api for getting more accurate and detailed information for reverse geocoding. I have tried same for auto filling the place names, but didn't worked,so went using google places api, there is one more free api try geonames.org
in .h file
#import <CoreLocation/CoreLocation.h>
#interface ClassDemo : NSObject<NSXMLParserDelegate,CLLocationManagerDelegate>
{
BOOL got;
BOOL needParser;
NSMutableArray *currentplaceArray;
}
#property (nonatomic, retain) CLLocation *currentLocation;
#property (nonatomic, getter = isResultsLoaded) BOOL resultsLoaded;
#property (strong, nonatomic) CLLocationManager *locationManager;
#property (strong, nonatomic) CLGeocoder *geoCoder;
in .m
#synthesize locationManager,currentLocation;
- (void)viewDidLoad
{
got=NO;
needParser=YES;
currentplaceArray=[[NSMutableArray alloc]init];
//******** Location MAnager Allocation And Intialization********//
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate=self;
[locationManager startUpdatingLocation];
}
- (void)locationManager:(CLLocationManager *)manager
didUpdateToLocation:(CLLocation *)newLocation
fromLocation:(CLLocation *)oldLocation
{
if ([self isResultsLoaded])
{
return;
}
[self setResultsLoaded:YES];
currentLocation = newLocation;
NSLog(#"%#",currentLocation);
NSXMLParser *parser = [[NSXMLParser alloc]initWithContentsOfURL:[NSURL URLWithString:[NSString stringWithFormat: #"http://maps.googleapis.com/maps/api/geocode/xml?latlng=%f,%f&sensor=false",newLocation.coordinate.latitude,newLocation.coordinate.longitude]]];
[parser setDelegate:self];
[parser parse];
}
-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{
NSLog(#"%#",elementName);
if([elementName isEqualToString:#"formatted_address"])
{
got = YES; //got is a BOOL
}
}
-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
if(got&&needParser){
got=NO;
NSLog(#"the address is = %#",string);
NSArray *tempPlaceArray=[string componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:#",/"]];
NSLog(#"%#",tempPlaceArray);
for(int i=0; i <[tempPlaceArray count]; i++)
{
NSString *tempString=[[tempPlaceArray objectAtIndex:i]stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSLog(#"%#",tempString);
if (![currentplaceArray containsObject:tempString])
{
if ([tempString length]!=0)
{
[currentplaceArray addObject:tempString];
}
}
}
needParser=NO;
TempLocation *obj=[[TempLocation alloc]init];
obj.countryName=[currentplaceArray objectAtIndex:[currentplaceArray count]-1];
obj.stateName=[currentplaceArray objectAtIndex:[currentplaceArray count]-2];
obj.cityName=[currentplaceArray objectAtIndex:[currentplaceArray count]-3];
obj.fullAdd=string;
[[Database getDBObject]insertIntoCurrentLocationTable:obj.cityName :obj.stateName :obj.countryName:obj.fullAdd];
}
}
make a temp location class for temporary storage. And you can also save to the database as.
Enjoy Coding.
Even I noticed same issue. After many trail and error I found the problem with wifi I was using. If the signal strength is low you'll get city as nil. Try changing your connection.
I have problem with the localization API in Core Location Services. I get the promt that request permission to the location services. If I click Allow and goes to Settings I can see that my app don't have permission.
This is my code in my GeoUtility class:
CLGeocoder *reverseGeocoder = [[CLGeocoder alloc] init];
CLLocationManager *lm = [[CLLocationManager alloc] init];
[lm setPurpose:#"Need to verify your region"];
[lm startUpdatingLocation];
It's trigged by a viewController in the viewDidAppear
I also have added location-services under Required Devices Capabilites in my plist file.
Add CoreLocation.framework and MapKit.framework
And
in .h
#import <MapKit/MapKit.h>
CLLocationManager *locationManager;
CLGeocoder *geocoder;
in view did load
- (void)viewDidLoad
{
locationManager = [[CLLocationManager alloc] init];
geocoder = [[CLGeocoder alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyBest;
[locationManager startUpdatingLocation];
}
then
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
CLLocation *currentLocation = newLocation;
if (currentLocation != nil) {
LongitudeLbl.text = [NSString stringWithFormat:#"%.8f",currentLocation.coordinate.longitude];
LatitudeLbl.text = [NSString stringWithFormat:#"%.8f",currentLocation.coordinate.latitude];
}
[geocoder reverseGeocodeLocation:currentLocation completionHandler:^(NSArray *placemarks, NSError *error) {
if (error == nil && [placemarks count] > 0) {
placemark = [placemarks lastObject];
NSString *addresstemp2 = [[NSString alloc] init];
NSString *subThoroughfare2 = [NSString stringWithFormat:#"%#",placemark.subThoroughfare];
NSString *thoroughfare2 = [NSString stringWithFormat:#"%#",placemark.thoroughfare];
NSString *postalCode2 = [NSString stringWithFormat:#"%#",placemark.postalCode];
NSString *locality2 = [NSString stringWithFormat:#"%#",placemark.locality];
NSString *administrativeArea2 = [NSString stringWithFormat:#"%#",placemark.administrativeArea];
NSString *country2 = [NSString stringWithFormat:#"%#",placemark.country];
if (![subThoroughfare2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%#",subThoroughfare2];
}
if (![thoroughfare2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%# %# \n",addresstemp2,thoroughfare2];
}
if (![postalCode2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%# %#",addresstemp2,postalCode2];
}
if (![locality2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%# %# \n",addresstemp2,locality2];
}
if (![administrativeArea2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%# %# \n",addresstemp2,administrativeArea2];
}
if (![country2 isEqualToString:#"(null)"]) {
addresstemp2 = [NSString stringWithFormat:#"%# %#",addresstemp2,country2];
}
AddressLbl.text = [[NSString alloc] initWithString:addresstemp2];
[AddressLbl sizeToFit];
[locationManager stopUpdatingLocation];
} else {
}
} ];
}
And you also change setting in your Simulator GO TO THE setting and choose Location Service change it to ON. see down is your application name if it is off then change to ON
I have tried this codes for getting the geolocation based values but not able to get the city name. How do I get the city name?
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
double lati = newLocation.coordinate.latitude;
_geo_coder_latitude_lbl.text= [[NSString stringWithFormat:#"%f",lati] retain];
_geocoder_latitude_str=_geo_coder_latitude_lbl.text;
NSLog(#"print lat;%#",_geocoder_latitude_str);
double longi = newLocation.coordinate.longitude;
_geocoder_longitude_lbl.text= [[NSString stringWithFormat:#"%f",longi] retain];
_geocoder_longitude_str=_geocoder_longitude_lbl.text;
NSLog(#"print lat;%#",_geocoder_longitude_str);
[self._geocoder reverseGeocodeLocation: locationManager.location completionHandler:
^(NSArray *placemarks, NSError *error)
{
//Get address
CLPlacemark *placemark = [placemarks objectAtIndex:0];
NSLog(#"Placemark array: %#",placemark.addressDictionary );
//String to address
_located_address = [[placemark.addressDictionary valueForKey:#"FormattedAddressLines"] componentsJoinedByString:#", "];
//Print the location in the console
NSLog(#"Currently address is: %#",_located_address);
// _ex_map_address_lbl.text=_located_address;
}];
[self _storeList_json_parser];
}
See the CLPlacemark docs, [CLPlacemark locatity] will return the city name associated with the placemark.
Check this sample code:
CLGeocoder *geocoder = [[CLGeocoder alloc] init];
double lati = 45.46433;
double longi = 9.18839;
CLLocation *location = [[CLLocation alloc] initWithCoordinate:CLLocationCoordinate2DMake(lati, longi)
altitude:0
horizontalAccuracy:0
verticalAccuracy:0
timestamp:[NSDate date]];
[geocoder reverseGeocodeLocation:location completionHandler:
^(NSArray *placemarks, NSError *error)
{
CLPlacemark *placemark = [placemarks lastObject];
if (error || !placemark)
return;
NSString *city = placemark.locality;
if (!city)
city = placemark.subAdministrativeArea;
NSLog(#"City for location: %#", city);
}];
I want to find out the weather from the current location.
For that I used the code as
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[self.locationManager stopUpdatingLocation];
self.location = newLocation;
// NSLog(#"lat long = %f,%f",self.location.coordinate.latitude,self.location.coordinate.longitude);
// Geocode coordinate (normally we'd use location.coordinate here instead of coord).
// This will get us something we can query Google's Weather API with
if (boolCurrentlyWorking == NO) {
CLGeocoder* reverseGeocoder = [[CLGeocoder alloc] init];
if(reverseGeocoder)
{
[reverseGeocoder reverseGeocodeLocation:newLocation completionHandler:^(NSArray *placemarks, NSError *error) {
CLPlacemark* placemark = [placemarks objectAtIndex:0];
if (placemark) {
//Using blocks, get zip code
NSString *zipCode = [placemark.addressDictionary objectForKey:(NSString*)kABPersonAddressZIPKey];
NSLog(#"placemark : %# zipcode : %#",placemark.addressDictionary,zipCode);
}
}];
}else{
MKReverseGeocoder *geocoder = [[MKReverseGeocoder alloc] initWithCoordinate:self.location.coordinate];
geocoder.delegate = self;
[geocoder start];
}
}
boolCurrentlyWorking = YES;
}
I am not getting zip code here.
Also found out that this method of didupdate location has been deprecated and new method is
-(void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations
{
CLLocation *location = [locations lastObject];
CLLocation *newlocation = location;
NSLog(#"location : %#",location);
CLGeocoder* reverseGeocoder = [[CLGeocoder alloc] init];
if(reverseGeocoder)
{
[reverseGeocoder reverseGeocodeLocation:newlocation completionHandler:^(NSArray *placemarks, NSError *error) {
for(CLPlacemark *placemark in placemarks)
{
NSLog(#"plcaemark desc : %#",[placemark description]);
}
}];
}
}
But it also does not contain zipcode.
I got this description
{
Country = India;
CountryCode = IN;
FormattedAddressLines = (
NH8C,
Gujarat,
India
);
Name = NH8C;
State = Gujarat;
Street = NH8C;
Thoroughfare = NH8C;
}
Is there like it does not provide zipcode information and we have to build it? If yes then how?
First of all We are not getting any zip code or postal code for India.
Also Google API has been stop working.
I used yahoo api to find out weather.
Here is the code that might help someone
-(void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
[self.locationManager stopUpdatingLocation];
self.location = newLocation;
NSString *linkForWoeid = [NSString stringWithFormat:#" http://where.yahooapis.com/geocode?location=%f,%f&flags=J&gflags=R&appid=zHgnBS4m",self.location.coordinate.latitude,self.location.coordinate.longitude];
NSURL *woeidURL = [NSURL URLWithString:linkForWoeid];
NSData *WoeidData = [NSData dataWithContentsOfURL:woeidURL];
if (WoeidData != NULL)
{
NSError *woeiderr = nil;
NSDictionary *aDicWOEIDResp = [NSJSONSerialization JSONObjectWithData:WoeidData options:NSJSONReadingMutableContainers error:&woeiderr];
NSDictionary *aDictWOEID = [[[[aDicWOEIDResp objectForKey:#"ResultSet"]objectForKey:#"Results"]objectAtIndex:0]objectForKey:#"woeid"];
NSString *address=[NSString stringWithFormat:#"http://weather.yahooapis.com/forecastrss?w=%#",aDictWOEID];
ICB_WeatherConditions *icbWeather = [[ICB_WeatherConditions alloc] initWithQuery:address];
}
#import "ICB_WeatherConditions.m"
- (ICB_WeatherConditions *)initWithQuery:(NSString *)query
{
if (self = [super init])
{
NSURL *url = [NSURL URLWithString:query];
CXMLDocument *parser = [[[CXMLDocument alloc] initWithContentsOfURL:url options:0 error:nil] autorelease];
NSDictionary *namespaceMedia = [NSDictionary dictionaryWithObject:#"http://xml.weather.yahoo.com/ns/rss/1.0" forKey:#"yweather"];
NSArray *nodes = [parser nodesForXPath:#"//channel" error:nil];
for (CXMLNode *node in nodes) {
if ([node kind] == CXMLElementKind)
{
CXMLElement *element = (CXMLElement *)node;
for(int i=0;i<[element childCount];i++)
{
NSString *strKey = [[element childAtIndex:i] name];
if([strKey isEqual:#"location"])
{
location = [self stringForXPath:#"#city" ofNode:[element childAtIndex:i] withNameSpace:namespaceMedia];
}
else if([strKey isEqual:#"item"])
{
NSArray *nodeItem = [element nodesForXPath:#"//item" error:nil];
CXMLElement *elementItem = [nodeItem objectAtIndex:0];
for(int j=0;j<[elementItem childCount];j++){
NSString *strKeyItem = [[elementItem childAtIndex:j] name];
if([strKeyItem isEqual:#"condition"]){
condition =[self stringForXPath:#"#text" ofNode:[elementItem childAtIndex:j] withNameSpace:namespaceMedia];
currentTemp = [[self stringForXPath:#"#temp" ofNode:[elementItem childAtIndex:j] withNameSpace:namespaceMedia] intValue];
}
else if([strKeyItem isEqual:#"forecast"])
{
NSString *date = [self stringForXPath:#"#date" ofNode:[elementItem childAtIndex:j] withNameSpace:namespaceMedia];
NSDate *curDate = [NSDate date];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
dateFormatter.dateFormat = #"dd MMM yyyy";
NSString *strCurDate = [dateFormatter stringFromDate:curDate];
if([date isEqual:strCurDate])
{
highTemp = [[self stringForXPath:#"#high" ofNode:[elementItem childAtIndex:j] withNameSpace:namespaceMedia] intValue];
lowTemp = [[self stringForXPath:#"#low" ofNode:[elementItem childAtIndex:j] withNameSpace:namespaceMedia] intValue];
}
}
}
}
else
continue;
}
}
}
}
return self;
}
This is how I get the weather Details.
In my case I only needed Location,Condition,High Temp,Low Temp,Current Temp.