gpt4 book ai didi

ios - 如何通过uiimagepickercontroller获取所选视频的地理位置

转载 作者:行者123 更新时间:2023-11-28 08:03:38 25 4
gpt4 key购买 nike

我正在尝试通过 PHAssets 获取图像和视频的地理位置,正在获取图像位置。

PHAsset.fetchAssetsWithALAssetURLs([imageUrl], options: opts).

When i used the same below code for video this returned zero.

PHAsset.fetchAssetsWithALAssetURLs([videoUrl], options: opts)  

最佳答案

这已在 iOS 8 上测试并适用于视频,因此它应该与照片类似,只需进行一些调整。

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

NSURL *videoUrl = (NSURL *)[info objectForKey:UIImagePickerControllerMediaURL];
NSString *moviePath = [videoUrl path];

if ( UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath) ) {

ALAssetsLibrary *assetLibrary = [[ALAssetsLibrary alloc] init];

[assetLibrary assetForURL:[info objectForKey:UIImagePickerControllerReferenceURL] resultBlock:^(ALAsset *asset) {

CLLocation *location = [asset valueForProperty:ALAssetPropertyLocation];
NSLog(@"Location Meta: %@", location);

} failureBlock:^(NSError *error) {
NSLog(@"Video Date Error: %@", error);
}];

}

}

关于ios - 如何通过uiimagepickercontroller获取所选视频的地理位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45830965/

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