I am updated an app from ios7 to ios8 and struggling to get UIImagePicker working to load a picture from the "My Photo Stream" category of photos. The UIImagePicker implementation is standard and I retrieve the URL of the selected photo with:
NSURL *url = [info objectForKey:@"UIImagePickerControllerReferenceURL"];
I then use the new IOS8 APIs for loading this photo:
PHFetchResult *result = [PHAsset fetchAssetsWithALAssetURLs:@[url] options:nil];
This fails to work. The result.count is zero and no image is found. The URL has an different UUID than if I select the photo from "Moments" or "Camera Roll" but looks well formed. (phone is running 8.1):
url NSURL * @"assets-library://asset/asset.JPG?id=4522DBD1-862C-42BE-AF7C-0D6C76CA7590&ext=JPG"
Anyone have some code to load photos from "My Photo Stream" or a way to disable it for the UIImagePicker display?
Using the older ALAssetsLibrary assetForURL API also fails to load these images.
I think you can try this to get "my photo stream" album.
Photos in My Photo Stream album are uploaded to iCloud and iCloud will manage them efficiently, photos captured within 30 days are there, and I think PHAsset or ALAssetLibrary dealt with locally stored assets. Here is a test I did on my device, I used a imagePicker to get a photo url from stream album, which was
And using PHAsset on the same photo I get its localIdentifier:
So I think you can strip id from url, and find out which asset's local identifier contains it, then you get the PHAsset you want.