0

first time I am touching Mediaquery and I am stucked. I have the following lines in xcode import MediaPlayer class ViewController: UIViewController{

override func viewDidLoad() {
    super.viewDidLoad()
         let mediaItems = MPMediaQuery.songsQuery().items

But media items is always empty / nil.

Any idea what I missed? Ok I found the reason, this is very time consuming to find such information.

Simulator: Unsupported frameworks include:

External Accessory Media Player

Rpw

rpw
  • 61
  • 1
  • 6

1 Answers1

1

Have you imported the MediaPlayer framework?

try this

import MediaPlayer
class CLASSNAME {
    override func viewDidLoad() {
        let allTracks: NSArray = MPMediaQuery.songsQuery().items as NSArray
        println("All tracks: \(allTracks)")
    }
}
Eli Lien
  • 55
  • 6