I found a solution using the following code:
if picker.sourceType == UIImagePickerControllerSourceType.PhotoLibrary { if let currentLat = pickedLat as CLLocationDegrees? { self.latitude = pickedLat! self.longitude = pickedLong! } else { var library = ALAssetsLibrary() library.enumerateGroupsWithTypes(ALAssetsGroupAll, usingBlock: { (group, stop) -> Void in if (group != nil) { println("Group is not nil") println(group.valueForProperty(ALAssetsGroupPropertyName)) group.enumerateAssetsUsingBlock { (asset, index, stop) in if asset != nil { if let location: CLLocation = asset.valueForProperty(ALAssetPropertyLocation) as CLLocation! { let lat = location.coordinate.latitude let long = location.coordinate.longitude self.latitude = lat self.longitude = lat println(lat) println(long) } } } } else { println("The group is empty!") } }) { (error) -> Void in println("problem loading albums: \(error)") } } }
What he does is that he reads the entire album and prints the location if the photo has this property, otherwise he prints “location not found”. He does this for every photo in the album. So, I have another question ... I want to display location information only for the photo I selected, and not for the entire album. Does anyone know how to do this?
source share