Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

217
Views
MPMusicPlayerController y usando API privada para obtener la cola actual

Hay una respuesta a esta pregunta: iOS: obtenga una cola programática de elementos que se están reproduciendo actualmente que describe cómo hacer esto, sin embargo, estoy probando ese método y no funciona. Aquí está mi código:

 let numberOfItems = player.value(forKey: "numberOfItems") as! Int for i in 0..<numberOfItems { if let mediaItem = MPMusicPlayerController.systemMusicPlayer.perform(Selector("nowPlayingItemAtIndex:"), with: i)?.takeUnretainedValue() as? MPMediaItem { let songObject = mediaItem.value(forKey: "propertyValues") as! NSObject print(songObject.value(forKey: "title")) print(mediaItem.title) print(mediaItem.value(forKey: "title")) print(mediaItem.value(forProperty: MPMediaItemPropertyTitle)) } }

Las 4 declaraciones impresas son nulas. Vale la pena señalar que, de hecho, puede convertir el elemento como MPMediaItem, y la variable songObject en realidad se imprime como MPModelSong. Los encabezados de tiempo de ejecución indican que hay una propiedad en los objetos MPModelSong "título" (que se encuentra aquí: https://github.com/nst/iOS-Runtime-Headers/blob/master/Frameworks/MediaPlayer.framework/MPModelSong.h )

Pase lo que pase, todo se imprime en cero. ¿Alguna idea de qué dirección debo tomar desde aquí?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!