How to convert the iPod library to NSData. The url is:
ipod-library://item/item.mp3?id=1258203422631791096
Getting error but, I can play the song by using AVPlayer.
NSURL *url = [curItem valueForProperty: MPMediaItemPropertyAssetURL];
NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:[url absoluteString] options:NSDataReadingMappedAlways error:&error];
NSLog(@"Error : %@",error);
The curItem is a MPMediaItem
Error Domain=NSCocoaErrorDomain Code=260 "The file “item.mp3?id=1258203422631791096” couldn’t be opened because there is no such file." UserInfo={NSFilePath=ipod-library://item/item.mp3?id=1258203422631791096, NSUnderlyingError=0x15ff23420 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}
AVAssetExportSession
. Only AVFondation stuff should be allowed to open files with "ipod-library". – Camass