iOS: select audio file from device and upload
ios
Solution
Add the MediaPlayer.framework in your project
#import <MediaPlayer/MediaPlayer.h>
Display like this:
MPMediaPickerController *mediaPicker = [[MPMediaPickerController alloc] initWithMediaTypes:MPMediaTypeMusic];
mediaPicker.delegate = self;
mediaPicker.allowsPickingMultipleItems = NO;
[self presentViewController:mediaPicker animated:YES completion:nil];
Implement delegate `<MPMediaPickerControllerDelegate>`
- (void)mediaPicker: (MPMediaPickerController *)mediaPicker didPickMediaItems:(MPMediaItemCollection *)mediaItemCollection
{
[self dismissViewControllerAnimated:YES completion:nil];
NSLog(@"You picked : %@",mediaItemCollection);
}
Problem
I am new to iOS. I am creating a dummy app to upload an audio file from iOS device on local server. So I was wondering if there is a way to open the audio gallery and select the required audio file to upload. Similar to an image gallery. Is it possible to open audio list and select necessary audio file? If not, what is the alternative?