iam developing one application.In that i need to get the music files from the phone library.For that iam using the MPMediaPickerCOntroller.But it doesn’t fire the didpickingitem delegate method.My code like below.
- (void)viewDidLoad
{
[super viewDidLoad];
MPMediaPickerController *picker =[[MPMediaPickerController alloc] initWithMediaTypes: MPMediaTypeMusic];
picker.delegate = self;
picker.allowsPickingMultipleItems = YES;
picker.prompt =@"Add songs to play";
[self presentModalViewController:picker animated: YES];
}
- (void) mediaPicker: (MPMediaPickerController *) mediaPicker didPickMediaItems: (MPMediaItemCollection *) mediaItemCollection
{
NSLog(@"sdfadsf");
NSLog(@"%@",mediaItemCollection);
NSArray *slist=[mediaItemCollection copy];
NSLog(@"%@",slist);
}
Do you declare the MPMediaPickerControllerDelegate in your .h?
ex:
If you do not that would explain why the method isn’t firing. Also, I do not believe it will work on the simulator; only on devices.
EDIT: