简体   繁体   中英

Access Photos.sqlite in iOS to retrieve photo meta data

I'm struggling to find information about how to access the Photos.sqlite database. The following information are missing:

  1. Is it possible to access the Photos.sqlite database from my own application/framework?
  2. If Yes , where can I find documentation about accessing the Photos.sqlite db?
  3. Is it possible to retrieve meta data from photos in the database? I would like to get the following meta data
    • Timestamp of photo
    • GPS information Latitude and Longitude

Assuming that there is NO chance to get the information out of the Photos.sqlite db. What's the best way to deal with photo meta data from the device photo library?

The following search criteria are relevant for me:

  • Retrieve photos by date
  • Retrieve photos by CLLocationCoordinates

Traversing all the photos in a for-loop every call is definitely too slow!!!

I think that dealing with photo libraries with 1000+ photos leaves me no choice as creating my own database. Is that right? If YES , does someone could give me a suggestion how the database model should look like?

To access photos from the device photo library, you don't access the sqlite database directly, but instead use the AssetsLibrary framework provided by Apple to retrieve the images and their associated metadata. See here for more information: https://developer.apple.com/library/ios/documentation/AssetsLibrary/Reference/ALAssetsLibrary_Class/Reference/Reference.html

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