objective c - CLLocation data getting null in iOS -


hello getting user location using cllocationmanageri can latitude,longitude,country name , administrative area. want city name or sub administrative area.

nsstring *address = [nsstring stringwithformat:@"%@ %@\n%@ %@\n%@\n%@",                              self.placemark.subthoroughfare, self.placemark.thoroughfare,                              self.placemark.postalcode, self.placemark.sublocality,                              self.placemark.subadministrativearea,                             self. placemark.country]; 

but except country andthoroughfare other values null. why that? how can solve issue? please me. thanks

you have country value , address string addressdictionary like

nsdictionary *dictaddress = [nsdictionary dictionarywithdictionary:placemark.addressdictionary];     nsmutabledictionary *dicttxtdata = [nsmutabledictionary dictionary];     nslog(@"country:%@",dictaddress[@"country"]); 

you have other details placemark

nslog(@"thoroughfare:%@",placemark.thoroughfare);     nslog(@"subthoroughfare:%@",placemark.subthoroughfare);     nslog(@"subadministrativearea:%@",placemark.subadministrativearea);     nslog(@"postcode:%@",placemark.postalcode); 

if have nil value change location or check popular location , check again , use direct placemark insten of self.placemark. output is:


Comments

Popular posts from this blog

java - Run spring boot application error: Cannot instantiate interface org.springframework.context.ApplicationListener -

python - pip wont install .WHL files -

Excel VBA "Microsoft Windows Common Controls 6.0 (SP6)" Location Changes -