2017-04-19 6 views
0

画像ピッカーから選択された画像からジオタグの位置を取得したい。私はこのコードGeoTag画像ピッカースウィフトの画像3

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)") 
    } 
} 

}私は数時間後に

答えて

0

を非常に参考になります迅速な3 .ITとコーディングに.Iは新しいですSWIFT 3でこのコードを転化するかを知りたい

を使用しています検索私は私のansを持って