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
Post a Comment