如何将 AVMetadataItem 值转换为 NSDate 或 NSString?

问题描述

我正在尝试获取视频拍摄日期并在 Xcode 中使用它填充 TextView。我选择了视频,然后从 AVMetadataItem creationDate 中获取日期。我可以将其打印为 NSLog,但我想将其转换为 String 或 NSData。 这是我在objective-c中的代码

在.h

@property(nonatomic,readonly,nullable) AVMetadataItem *creationDate;

并在.m

NSURL * movieURL = [info valueForKey:UIImagePickerControllerMediaURL] ;
       AVURLAsset *anAsset = [[AVURLAsset alloc] initWithURL:movieURL options:nil];
        NSLog(@"creationDate:%@",anAsset.creationDate.value);

在日志中我得到了 creationDate:Tue Jan 26 09:44:39 2021,这是我拍摄视频的日期。 我现在的问题是将其转换为可用的形式。

当我尝试

Nsstring = anAsset.creationDate.value;

我收到警告

Initializing 'Nsstring *_strong' with an expression of incompatible type 'id<NSObject,NScopying> _Nullable'

无论我尝试什么,我基本上都会收到同样的警告。

有人可以帮我解决这个问题吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)