Resolved Camera Roll Out of Order FIX/tutorial

Discussion in 'iOS 11' started by Mr_Brightside_@, Oct 19, 2017.

  1. Mr_Brightside_@, Oct 19, 2017
    Last edited: Jan 8, 2018

    Mr_Brightside_@ macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #1
    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?
     
  2. crookadile macrumors regular

    Joined:
    Jul 2, 2013
    Location:
    Rotherham South Yorkshire UK
    #2
    Hi, I'm stuck on 2) Open terminal. maybe it's because I am using a PC and not a Mac.
    I can't find Open Terminal in Imazing. Is there a tutorial for Windows.
    Any help would be appreciated. Thanks.
     
  3. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #3
    Terminal is a Mac coding/command line application. You will need an SQLite editor. It looks like it is built into yours as well:
    https://sqlite.org/cli.html
     
  4. lelisa13p macrumors 68000

    lelisa13p

    Joined:
    Mar 6, 2009
    Location:
    Atlanta, GA USA
  5. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #5
    You can try it using the command prompt.
     
  6. lelisa13p macrumors 68000

    lelisa13p

    Joined:
    Mar 6, 2009
    Location:
    Atlanta, GA USA
  7. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #7
    Well, experience is what you get when you thought you were getting something else.
     
  8. nginok macrumors newbie

    nginok

    Joined:
    Dec 7, 2017
    #9
    Thanks! it works!!

     
  9. mustafahussain17 macrumors newbie

    Joined:
    Jan 8, 2018
    #10
    Screen Shot 2018-01-08 at 22.48.35.png
    Can someone please help? I really need my camera roll in order but everytime I do this I get the error above saying there is no such module...Thanks!
     
  10. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #11
    Use Terminal it doesn’t work in SQLite browser.
     
  11. doubletap macrumors regular

    Joined:
    Jan 2, 2009
    Location:
    Ashburn, VA
    #12
    I've also read that if you use iCloud Photos, you need to remove the directory and DCIM portion of this step:

    UPDATE zgenericasset SET zaddeddate = zdatecreated WHERE zaddeddate>0 AND zdirectory LIKE 'DCIM%';

    so it reads:

    UPDATE zgenericasset SET zaddeddate = zdatecreated WHERE zaddeddate>0;

    I use iCloud Photos and used the modified command without issue fwiw.
     
  12. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #13
    This sounds correct - someone commented the same on Apple forums. Thanks for sharing it here!
    --- Post Merged, Jan 9, 2018 ---
    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?
     
  13. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #14
    Update re iOS Photos app search being broken: deleting the Photos.sqlite file also seems to re-index the search function. Search categories and dates are now appearing properly. Note also that you may need to sync with a computer.
     
  14. doubletap macrumors regular

    Joined:
    Jan 2, 2009
    Location:
    Ashburn, VA
    #15
    that's good to know that simply deleting the sqlite file also works. thanks for reporting back!
     
  15. sukimu macrumors newbie

    Joined:
    Sep 23, 2018
    #16






    I followed this tutorial to the letter, however when i move back the modified Photos.sqlite my entire library disappears and starts rebuilding from 0. When it is done the photos are still out of order.
    Can you please help????
     
  16. Mr_Brightside_@ thread starter macrumors 68030

    Mr_Brightside_@

    Joined:
    Sep 23, 2005
    Location:
    Toronto
    #17
    That sounds like the database wasn't modified. Does the modified date update in Finder?

    Do you have iCloud Photo Library enabled?
     
  17. lordofthegins macrumors member

    lordofthegins

    Joined:
    Sep 17, 2018
    Location:
    Hawke's Bay, New Zealand
    #18
    Hey all. After heaps of research, i've finally found this post!

    I have iCloud Photo Library setup, so as long as I follow the above steps (with DoubleTaps) edits, this won't affect my iCloud library at all?
     
  18. lordofthegins macrumors member

    lordofthegins

    Joined:
    Sep 17, 2018
    Location:
    Hawke's Bay, New Zealand
    #19
    Getting the same thing. Modified date in finder updates to when its saved.
    When I modify the photos.sqlite file in iMazing, I notice there's two other files that are created:
    photos.sqlite-wal and photos.sqlite-sh

    Anyone know what those are?

    Completed the tutorial with DoubleTaps iCloud photo edit, but the library is rebuilding from zero, with dates still out of sync
    --- Post Merged, Apr 16, 2019 ---
    Did you manage to resolve this?
     

Share This Page

18 October 19, 2017