2011-12-05 8 views

Respuesta

27

Lea la documentación: MPNowPlayingInfoCenter

Y aquí es un ejemplo de código que funciona en iOS 5 y no se colgará en versiones anteriores de iOS.

Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); 

if (playingInfoCenter) { 
    MPNowPlayingInfoCenter *center = [MPNowPlayingInfoCenter defaultCenter]; 
    NSDictionary *songInfo = [NSDictionary dictionaryWithObjectsAndKeys: 
          @"Some artist", MPMediaItemPropertyArtist, 
          @"Some title", MPMediaItemPropertyTitle, 
          @"Some Album", MPMediaItemPropertyAlbumTitle, 
          nil]; 
    center.nowPlayingInfo = songInfo; 
} 
+0

Gracias! No se puede hacer con solo 1 clase en iOS5. – samwize

+0

Debe haber alguna forma de hacerlo sin iOS5 ... –

+0

No, no, ya que esta API solo está disponible en iOS 5. Antes de iOS no hay API para lograr esto. – rckoenes

Cuestiones relacionadas