Tutorial :Access Photo Album from iPhone Code



Question:

iPhone Apps like "Picture Map" access all the photos in my iPhone's camera album and display them without ever showing an Image Picker Control.

Does anyone know how this is done?

Thanks G


Solution:1

This is an old thread but I will answer as I'm the one who wrote and published Picture Map !

Thomas is right, I was accessing the DCIM folder to parse each file (to get its location from the EXIF structure and to access thumbnails too).

As an application has no right to access files outside of its sandbox, Apple asked me to remove the application from the AppStore ... And anyway, since iOS 4.0, application are not able to access DCIM folder anymore !

I did rewrite the application to use ALAsset class and published it again under the name of "Picture-Map" ! The source code is also available here : https://github.com/sylverb/Picture-Map


Solution:2

I believe I know what's going on:

There are two separate photo collections on an iPhone:

  1. The iPhoto album, which is synched from the iPhoto app on the Mac.
  2. The pictures taken with the iPhone camera.

The iPhoto album is not accessible by normal apps (provided we're not talking about jailbroken devices here) - an app can only request that the user picks picture by picture by hand.

The pictures taken by the camera, however, end up in a "DCIM" folder which is shared between all applications, along with other data. You can see all that if you use the Mac application "iPhone Explorer" (I am sure there are similar apps for Windows as well).

Hence, while never having tried out "Picture Map" myself, I suspect that it simply accesses this DCIM folder.

...

Oh, now wait... I just used iPhone Explorer to look at my iPad's shared folder (/var/mobile/Media) and see that there's not only the DCIM folder there but also a Photos folder, which contains a "Photo Database", just like on the Mac. Wow, this is interesting... This could mean that "Picture Map" actually reads this DB file directly. It's been done on the Mac, and I suspect that the file format on the iPhone OS isn't much different, either.

Does that answer your question?


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »