0

I am trying to get the date a video was taken and populate a TextView with it in Xcode. I have chosen the video and then gotten the date from the AVMetadataItem creationDate. I can print it out as a NSLog but I want to convert it into a String or NSData. Here is my code in objective-c

in .h

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

and in .m

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

in the log I get creationDate:Tue Jan 26 09:44:39 2021 which is the date I took the video. My problem is now converting it to a usable form.

When I try

NSString = anAsset.creationDate.value;

I get a warning

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

I basically get this same warning no matter what I try.

Can someone help me get this working?

user1114881
  • 731
  • 1
  • 12
  • 25
  • `NSDate *creationDate = (NSDate *)anAsset.creationDate.value` ? Or `NSString *creationDate = (NSString *)anAsset.creationDate.value` it depends if that's supposed to be a `NSDate` or a `NSString` object. – Larme Mar 11 '21 at 22:58
  • Do you know if there is a GPS metadata value stored with video? – user1114881 Mar 13 '21 at 16:14

0 Answers0