0)
Back up your phone and place it in Airplane mode (DigiDNA's suggestion)
1)
Make sure Photos is running on your iPhone
Download iMazing or similar
Connect iPhone to Mac via USB
In the sidebar select your phone
Click File System > Media > PhotoData
Select Photos.sqlite and Copy to Mac at bottom
Find the file you've just copied
First, make a copy of it in a separate location in case of emergency
2)
Open Terminal
At the prompt type
$ sqlite3
You should see your SQLite version listed
Type .open at the sqlite> prompt, then drag the Photos.sqlite file from Finder to the sqlite> prompt, then hit Enter:
sqlite> .open /Users/yourname/Desktop/Photos.sqlite
To test that you've opened the file properly, type .tables and hit enter. You should see a list of files starting with Z, which is what you want.
At the prompt again, paste in:
UPDATE zgenericasset SET zaddeddate = zdatecreated WHERE zaddeddate>0 AND zdirectory LIKE 'DCIM%';
Hit enter. There should be a slight, 1 second delay before you see the sqlite> prompt again. This means the query is working, which is good. You should also see the Modified date for the sqlite file change in Finder
Finally, type .save Photos.sqlite and hit Enter (not actually sure if this is necessary or does anything, but I did it when I was successful)
Quit Terminal, clicking Close on the warning window
3)
Go back to iMazing into the PhotoData folder
I made a 'backup' of the existing Photos.sqlite by renaming it to oldPhotos.sqlite
Copy over the modified Photos.sqlite from your Mac
Quit iMazing
Force quit the Photos app
Reopen Photos
Hopefully, your photos will be in order!
Let me know if this works for you!
UPDATE 31 DEC:
I noticed in Moments (Photos tab at left) that most of the thumbnails were incorrect. I force quit Photos, then again using iExplorer, I navigated to \PhotoData\Thumbnails\ and backed up, then deleted all ithmb files. All seems to be good now. Not sure if this is related but thinking it is!
Another annoying oddity: I've found the Photos search feature isn't properly indexed. If I search for a category or location (say, Dog) I get far fewer results than I used to (before applying the fix I think).
Does anyone have any insight on where this might be located?
Back up your phone and place it in Airplane mode (DigiDNA's suggestion)
1)
Make sure Photos is running on your iPhone
Download iMazing or similar
Connect iPhone to Mac via USB
In the sidebar select your phone
Click File System > Media > PhotoData
Select Photos.sqlite and Copy to Mac at bottom
Find the file you've just copied
First, make a copy of it in a separate location in case of emergency
2)
Open Terminal
At the prompt type
$ sqlite3
You should see your SQLite version listed
Type .open at the sqlite> prompt, then drag the Photos.sqlite file from Finder to the sqlite> prompt, then hit Enter:
sqlite> .open /Users/yourname/Desktop/Photos.sqlite
To test that you've opened the file properly, type .tables and hit enter. You should see a list of files starting with Z, which is what you want.
At the prompt again, paste in:
UPDATE zgenericasset SET zaddeddate = zdatecreated WHERE zaddeddate>0 AND zdirectory LIKE 'DCIM%';
Hit enter. There should be a slight, 1 second delay before you see the sqlite> prompt again. This means the query is working, which is good. You should also see the Modified date for the sqlite file change in Finder
Finally, type .save Photos.sqlite and hit Enter (not actually sure if this is necessary or does anything, but I did it when I was successful)
Quit Terminal, clicking Close on the warning window
3)
Go back to iMazing into the PhotoData folder
I made a 'backup' of the existing Photos.sqlite by renaming it to oldPhotos.sqlite
Copy over the modified Photos.sqlite from your Mac
Quit iMazing
Force quit the Photos app
Reopen Photos
Hopefully, your photos will be in order!
Let me know if this works for you!
UPDATE 31 DEC:
I noticed in Moments (Photos tab at left) that most of the thumbnails were incorrect. I force quit Photos, then again using iExplorer, I navigated to \PhotoData\Thumbnails\ and backed up, then deleted all ithmb files. All seems to be good now. Not sure if this is related but thinking it is!
Another annoying oddity: I've found the Photos search feature isn't properly indexed. If I search for a category or location (say, Dog) I get far fewer results than I used to (before applying the fix I think).
Does anyone have any insight on where this might be located?
Last edited: