4

I'm currently writing my first app and deal with PHAssets quite a bit. One attribute of PHAsset that is particularly important for what I'm trying to achieve is creationDate. This value is optional, so there are times when it can be nil:

https://developer.apple.com/documentation/photos/phasset/1624776-creationdate

It's not at all clear to me why this value would ever be nil, and I'm having difficultly reproducing this in iOS's Photos app to see how it deals with this case. I've tried clearing all metadata from some image files, and manually copying these into my Photos library, but creationDate is still not nil :/ Any ideas at all? I'd really like to see how the Photos app deals with such image files, as I'm trying to reproduce a similar user experience in my app.

For reference, I'm clearing the metadata using exiftool:

exiftool -overwrite_original -all= /path/to/image.jpg
StarGeek
  • 4,948
  • 2
  • 19
  • 30
Meg
  • 41
  • 1
  • Don’t confuse the exif data, which might tell when the photo was captured, with the asset creation date. – matt Jun 01 '18 at 17:32
  • I presume it may be similar to the case of `UITextField.text` being optional even though it doesn't matter (as asked [here](https://stackoverflow.com/q/42861115/2857130)). [One answer here](https://stackoverflow.com/a/42861357/2857130) says that it's for objective-c compatibility while [another one here](https://stackoverflow.com/a/42862889/2857130) states it's a bug. *But this is just me guessing and making connections.* Now whether to force unwrap or safe unwrap is what I'd like to know too. – staticVoidMan Jun 04 '18 at 10:10

0 Answers0