PHAsset CLLocation is not giving location same as photos app

213 views Asked by At

We are fetching the latitude and longitude from PHAsset properties we are using CLGeocoder to reverseGeocodeLocation using following method.

CLGeocoder * geoCoder = [CLGeocoder new];
[geoCoder reverseGeocodeLocation:loc completionHandler:^(NSArray<CLPlacemark *> * _Nullable placemarks, NSError * _Nullable error) {
    CLPlacemark *placeInfo = placemarks[0];

}    

we are getting placeInfo object but thoroughfare and subThoroughfare are always coming nil.

For the same photo photosapp is able to fetch thoroughfare and subThoroughfare.

Thank You in advance.

1

There are 1 answers

1
PlusInfosys On

thoroughfare and subThoroughfare property that might not contain data for some places. So instead of creatying address string using thoroghfare and subThoroghfare, use addressdictionary as follow:

 NSString *address = ABCreateStringWithAddressDictionary(placeInfo .addressDictionary, NO);