Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ios 8, how to get all photos using ALAssetLibrary to replace the missing camera roll album

I have an app that has a custom Image Picker that uses the ALAssetLibrary to create an Album picker and image picker. We've implemented a custom picker in order for our customers to select multiple images. This image picker works great under iOS 7 and shows the "Camera Roll" album with ALL the user's photos. However, when running the same app under iOS 8, it seems that Apple has removed the "Camera Roll" album from the Albums view and only shows "Recent Photos". From what I can see, the only way to access all photos in iOS 8 is through the Collection view (in the Photos app or the new built-in picker). Unfortunately, I can't use Photokit at this time because I still need to support my iOS 6 & 7 users. Does anyone know of a way to obtain all the assets and create a custom camera roll album using the ALAssetLibrary when running an iOS 7 app under iOS 8 (compiled in Xcode 5)?

UPDATE

Well, as I stated in my original post above, I was not initially able to use the new Photos Framework (PhotoKit). However, we recently moved our builds to Xcode 6 and I can now use the photos framework to create a group of all photos (look at the WWDC ExampleappusingPhotosframework sample code for how to do this).

However, as powerful as everyone is saying PhotoKit is, it's missing some crucial filtering capabilities. In fact there is no easy way to filter out photos in the original "PhotoStream" using a predicate with PHFetchResult. You can only use the public properites. Fortunately, I figured out how to filter them using the PHAsset description. The assetSource key listed in the description is equal to 2 if the photo is in the user's photostream. So, I used fast enumeration on the results and moved all the assets to an array that were not in the PhotoStream using a simple stringInRange filter on the asset.description property (looking for "assetSource=2"). It may not be the best solution, but it works for now so a user does not see duplicates of their photos from both the local library and their photostream. At least I can present all the customer's photos and allow my multi media picker to function as close as the original class that used the ALAssetLibrary.

By all mean, if someone has a better solution using a predicate, please lmk.

like image 778
stulevine Avatar asked Sep 10 '14 17:09

stulevine


People also ask

Where is Camera roll iOS 15?

This new feature is built into the Photos app. But if you're taking pictures with the Camera app and you tap on the camera roll in the lower-left to swipe through recent photos, you can use it there as well. Visual Look Up puts information about common animals, plants, art, and landmarks just a few taps away.

How do you use the photo app on iPhone?

View individual photosTap a photo to view it in full screen on your iPhone. Double-tap or pinch out to zoom in on the photo—drag to see other parts of the photo; double-tap or pinch closed to zoom back out. to add the photo to your Favorites album. See Use albums in Photos.


1 Answers

I'm having the same issue. Couldn't found proper documentation saying that the Assets Library doesn't have access to those photos anymore, but the Release Notes for iOS 8 says you can use the PhotosFramework for that. Haven't tested yet though.

The Photos framework (Photos.framework) provides new APIs for working with photo and video assets, including iCloud Photos assets, that are managed by the Photos app. This framework is a more capable alternative to the Assets Library framework.

Maybe that means we have to use it on iOS 8+ ?

UPDATE: Not being able to access all photos is a bug on iOS 8.0 and it was fixed on 8.0.2. See my other answer below.

like image 128
Anas Avatar answered Sep 27 '22 20:09

Anas