0

我正在尝试获取视频的拍摄日期并在 Xcode 中使用它填充 TextView。我选择了视频,然后从 AVMetadataItem creationDate 中获取了日期。我可以将其打印为 NSLog,但我想将其转换为字符串或 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'

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

有人可以帮我完成这项工作吗?

4

0 回答 0