From a00c1c49f523ccb61ec24a8e4337def0fbd3085c Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Mon, 25 Oct 2010 09:19:48 +0000 Subject: [PATCH] Update PhotoLibrary for 4.x. --- PhotoExample.cydget/index.html | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/PhotoExample.cydget/index.html b/PhotoExample.cydget/index.html index 2e51892..3cedb18 100644 --- a/PhotoExample.cydget/index.html +++ b/PhotoExample.cydget/index.html @@ -108,11 +108,22 @@ document.write(''); dlopen("/System/Library/PrivateFrameworks/PhotoLibrary.framework/PhotoLibrary", RTLD_GLOBAL); - var album = [[PLCameraAlbum sharedInstance] images]; + + var old = [PLCameraAlbum respondsToSelector:@selector(sharedInstance)]; + + var album; + if (old) + album = [[PLCameraAlbum sharedInstance] images]; + else + album = [[[PLPhotoLibrary sharedPhotoLibrary] albums][0] contents]; var jpeg = null, length = album.length; for (var i = 0; i != 5; ++i) { - jpeg = [[album[Math.floor(Math.random() * length)] fileGroup] pathForFullSizeImage]; + var object = album[Math.floor(Math.random() * length)]; + if (old) + jpeg = [[object fileGroup] pathForFullSizeImage]; + else + jpeg = '/var/mobile/Media/' + [object directory].toString() + '/' + [object filename].toString(); if (jpeg != null) break; } -- 2.45.2