i am getting the null values ,whenever i am using MPMediaItemCollection
convert MPMediaItemPropertyAssetURL
to data?
here my code
MPMediaItemCollection *collection=[allAlbumsArray objectAtIndex:indexPath.row];
MPMediaItem *item = [collection representativeItem];
NSLog(@" songs titles_str url is===>%@",[item valueForProperty:MPMediaItemPropertyAssetURL]);
NSLog(@"class type is %@",[[item valueForProperty:MPMediaItemPropertyAssetURL] class]);
self.songData=[NSData dataWithContentsOfURL:[item valueForProperty:MPMediaItemPropertyAssetURL]];
NSLog(@"original data is %@",self.songData);
here i am getting url for song ipod-library://item/item.mp3?id=-9207595762773025867
but when i convert into data i getting null value Thanks for advance.
The problem here is that the URL has a custom scheme,
ipod-library
, which can only be used withAVFoundation
methods, for exampleAVAsset
objects.The MPMediaItem Class Reference says this about
MPMediaItemPropertyAssetURL
: