gpt4 book ai didi

ios - iPhone图库在swift中选择图像位置

转载 作者:行者123 更新时间:2023-11-30 11:32:23 40 4
gpt4 key购买 nike

我需要根据图库中的图像位置(图像拍摄位置纬度和经度)调用 api。任何人都可以帮助我提供正确的指南或示例代码

最佳答案

是的,您可以使用 API 并获取图像位置,请查看下面的示例代码

https://gist.github.com/sumitlni/6421aece205ebefa647abe701d2429e0

// this code will be executed with in callback of 
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any])..

let opts = PHFetchOptions()
opts.fetchLimit = 1
let assets = PHAsset.fetchAssets(withALAssetURLs: [URL], options: opts)
for assetIndex in 0..<assets.count {
let asset = assets[assetIndex]
// print("Location: \(asset.location?.description) Taken: \(asset.creationDate)")
location = String(describing: asset.location!)
// Here you have the location if it found
}

关于ios - iPhone图库在swift中选择图像位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50128529/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com