Reputation: 3767
I am exploring the MPMediaPickerController for the first time, and I don't see anything when my button is pushed. The MPMediaPickerController.view has a frame after it is presented but it is not visible at all, nor does it appear in the view hierarchy. I am just using a simple fresh POC application with a ViewController and a IBOutlet button constrained to center vertical and horizontal, that calls this function:
func checkMediaAccess() {
let status = MPMediaLibrary.authorizationStatus()
switch status {
case .authorized:
showMediaPicker()
case .notDetermined:
MPMediaLibrary.requestAuthorization() { status in
if status == .authorized {
DispatchQueue.main.async {
self.showMediaPicker()
}
}
}
break
case .denied:
print("Denied")
break
case .restricted:
break
@unknown default:
break
}
}
Which then calls this function on authorized:
func showMediaPicker() {
print("SHOWING")
let picker = MPMediaPickerController(mediaTypes: .music)
picker.allowsPickingMultipleItems = false
picker.popoverPresentationController?.sourceView = pickerButton
picker.showsCloudItems = true
picker.delegate = self
self.present(picker, animated: true, completion: nil)
print(picker.view.frame )
}
"SHOWING" is printed, but again I don't see anything. I don't get anything else printed either.
I have all the info.plist descriptions for Media and Music access in. I also do get the prompt to allow the first time, and again "SHOWING" is printed. I have the delegates implemented, but they are never fired, because I don't see the view.
Nothing happens visually when I tap the button, and I can tap the button again.
What am i missing?
Upvotes: 2
Views: 698