Tag Archives: apps

HipStyles was removed from the App Store over a year ago, but from time to time I still think it could be resurrected. However, after taking a long hard look at Apple’s new Photos framework in iOS 9, I think it is just not feasible anymore.

HipStyles and the Assets Library Framework

HipStyles was a photo finder for Hipstamatic and Oggl photos, looking for snaps taken with some Hipstamatic lens, film or flash of your choosing. It was developed because it was increasingly difficult to find and categorize the great shots you took with the many virtual vintage films and lenses available in Hipstamatic. They still publish new gear monthly, and Eric Rozen’s Hipstography does a great job in covering them.

Technically, what HipStyles did is look at your iPhone’s photo album, pull out certain metadata from the photo, and present the results. When Hipstamatic saves a photo, it writes the gear information in some fields in the {TIFF} metadata dictionary. You can observe this yourself if you use some metadata reader application on a Hipstamatic photo.

Using the old Assets Library Framework this was relatively easy, if not too fast. Basically you would just get an instance of the assets library, and then loop through the photo assets and act on the information:

In practice, it is now a lot easier to load photos from the user’s photo library, which could now be completely or partially in the cloud. If you have turned on the iCloud Photo Library feature in iOS, the master copies of your photos will be in cloud storage, and the Photos application (or some app that you developed yourself) will manage the downloading and caching of the assets as necessary.

Once you have the assets, you would then go on picking stuff from the metadata.

Initially it sounded like a no-brainer to just make HipStyles use the new Photos framework. However, the Photos framework does not expose all the metadata that HipStyles needs. Specifically the {TIFF} metadata is not available without getting all the image data first.

When you get the image data, it is possible to extract the metadata. This is a function to handle the results of an image request:

On the surface, it sounds simple: just get the image data for each image, extract the metadata, and do whatever you need with it. There is just one problem, and it’s a big one: you need to get all the image data first. All of it.

Consider a user that has a couple of thousand photos in their photo library, and they have decided to store all their photos in iCloud. Each of these photos could be multiple megabytes in size. We don’t know which of those photos are interesting for HipStyles, and we can’t know unless we get the image data of each and every one candidate. So you will create a PHCachingImageManager, set its options, configure some image request options, and send the image manager on a mission:

Then you wait… and wait… and wait. The image manager will happily retrieve all the photos from iCloud over the network. I don’t know about you, but my vintage iPhone 5 from the year 2012, with 32 GB of storage and full of apps, otherwise happily running iOS 9.2.1 with no problems, will freeze and reboot when storage gets absolutely full. So I experienced a couple of crashes when I tested the photo retrieval code above, because the image manager dutifully filled my storage with local copies of the photos from iCloud. All because of me wanting to get at the some photo metadata that was not available from the PHAsset class.

You can make the metadata retrieval easier for you if use a helper like PHAsset+Utility, but I don’t think it will make the root problem go away: to get at certain pieces of photo metadata, you need to get all the image data first.

In iOS 9, the Assets Library Framework is deprecated in favour of the new Photos framework. There is obviously no guarantee about how long the old Assets Library framework will be operational anymore, and anyway it doesn’t handle the iCloud photo library use case at all.

If you have any ideas, by all means send them my way. But at this point I’m convinced that it is not feasible to recreate HipStyles using the Photos framework.