This is a question that keeps coming up as I try to merge my older Rolls and the current Camera Roll on iOS11.
What I've done:
-Prepared old Camera Rolls for import (EXIF fixes for dates, setting Date Created/Modified to the same dates).
-Merged new CR with names adjusted to avoid conflicts
-Copied to DCIM
-Nuked Photos.sqlite db
As expected, Moments picks up the correct date (as it should), but Camera Roll is weird.
It appears that files are sorted by date, but ONLY per each folder. E.g. photos in 100-111APPLE show up sorted by dates taken by each folder, but overall in the camera roll they are not. Is there a reason sorting is applied per folder?
Also, for some reason 109APPLE appeared at the very end of the camera roll - why could that be?
I was going through the Photos db (wow it got much messier since iOS 6), and couldn't deduce the sort order in the Camera Roll. Previously, the general belief was it is sorted by Date Created or Date Added, but when I sort the db by these parameters, photo order is different from what I see in the roll.
To make matters worse, not all (per-folder) sorting appears to be correct, as I have at least 2 photos from Jan12 that follow Apr12, and these 2 photos go from 17Jan12 to 16Jan12. I've tried sorting the folder in Explorer by pretty much all the attributes Windows gives me, and could not replicate this order. So my question is, what is going on? What is the primary key used for sorting the db in iOS 11?
P.S. I am aware I can manually run an sql query to copy ZDATECREATED to ZDATEADDED, but I want to understand, what is going on in the first place. Also not sure how manual sql edits would impact future exports to iCloud Photo Library.
TLDR: iOS Camera Roll sorting is weird - by what attribute is it sorted? When I sort the sql table by ZDATEADDED it is not the same order as on device, however if I run a manual query to set ZDATEADDED to ZDATECREATED, it seems to sort by the updated Date Added/Date Created timestamp, making it look like ZDATEADDED is indeed the primary sort key. Where does iOS even get Date Added (not from file/EXIF?), and how do I import photos into the camera roll preserving/setting the correct Date Added?
Thanks for any help.