简体   繁体   中英

Videos recorded from app has incorrect creation date from PHAsset

I have an app that records video and displays them in a certain order. The videos recorded in my app has the correct date, but the times were all the same. So, all of the video recorded today show: 2015-07-31 13:15:51 +0000

I'm not setting any properties related to time in my capture session or movie output. I can't seem to find any documentation on how to do this properly. Does anyone have an idea?

Thanks!

Update: I recorded more video within the app. Turns out that the date is also wrong. It's creation date reads the same as all the other videos created previously. For kicks, I delete the app from my phone, recorded a new video. It has the correct day and time. But after recording a second video, the date and time is the same as the previous recorded video.

It turns out that I was writing over the same file path. Creating a unique string each time solved my problem.

        let uuid = NSUUID().UUIDString
        let outputPath: NSString = "\(NSTemporaryDirectory()) + \(uuid) + output.mov"
        let outputURL = NSURL(fileURLWithPath: outputPath as String)
        movieFileOutput?.startRecordingToOutputFileURL(outputURL, recordingDelegate: self)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM