Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMediaPickerController.showsCloudItems seems to do nothing

Posted this on Apple with no luck, but now that the iOS 6 NDA is up, hoping more eyes will see it here.

I am attempting to modify an app to only allow a user to select music that has been downloaded locally. I have the following code under iOS 6 GM:

 MPMediaPickerController* mpc = [[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeAnyAudio];

mpc.allowsPickingMultipleItems = YES;
mpc.modalPresentationStyle = UIModalPresentationCurrentContext;
mpc.showsCloudItems = NO;

[self presentViewController:mpc animated:YES completion:nil];

From the documentation:

The default behavior for a media item picker is YES, which means the the picker shows available iCloud items. A media item is considered an iCloud item if it is available via iTunes Match and is not already stored on the device.

I take this to mean that if iTunes Match is enabled, only items that have been downloaded to the device will show in the picker, however I always see the entire iTunes Match library. I filed a radar for this, because it seems like a serious bug. If anyone can tell me otherwise, I'd love to know what I'm missing here.

like image 801
nickbona Avatar asked Sep 19 '12 20:09

nickbona


1 Answers

This seems to be an OS problem.

Using picker.showsCloudItems = NO; correctly shows fewer songs, instead of the whole list... The songs listed there are songs that either were manually downloaded in the Music app or songs that were streamed and therefore cached.

The problem, at least in my case, is dealing with the cached ones.

If I select a song that was manually downloaded the value of MPMediaItemPropertyIsCloudItem is NO, which is correct. I can also access the asset's URL through the MPMediaItemPropertyAssetURL property.

On the other hand, selecting a song that was cached returns YES on MPMediaItemPropertyIsCloudItem and nil on MPMediaItemPropertyAssetURL, making the song virtually useless to me.

Sorry I don't have an actual answer but I don't have enough reputation to simply comment.

Hope my 2 cents help somehow, but it truly seems to me that this issue can only be resolved by Apple in a future update.

like image 193
Hugo Sousa Avatar answered Oct 18 '22 15:10

Hugo Sousa