1

I have this app that is in landscape orientation where users can select songs from the MPMediaPicker View. The problem im having is that when I try to open the music library it doesn't work in landscape orientation, it only works if the app is in portrait orientation. Why and how do I fix this problem. This is the error I get when I try to show the picker view:

Terminating app due to uncaught exception 'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has no common orientation with the application, and [MPMediaPickerController shouldAutorotate] is returning YES

        if node.name == "addmusictoright" {
            addMusicToRightTurntable.run(sequencePushUpAndDown)

            mediaPicker2 = MPMediaPickerController(mediaTypes: .anyAudio)

            if let picker = mediaPicker2{
                isMediaPickerTwo = true
                isMediaPickerOne = false

                print("Successfully open media picker Right")
                picker.delegate = self
                picker.allowsPickingMultipleItems = false
                picker.showsCloudItems = false
                picker.prompt = "Please pick one song for the right turntable!"
                self.view?.window?.rootViewController!.present(picker, animated: true, completion: nil)
            } else {
                print("PICKER WONT OPEN")
            }
        }
xcode22
  • 118
  • 1
  • 9

0 Answers0