2013-10-11 4 views

답변

2

원하는 클래스는 MPNowPlayingInfoCenter입니다.

값의 사전을 만들고 다음과 같이 그렇다고 그것을 전달할 ...

NSMutableDictionary *info=[NSMutableDictionary dictionaryWithObjects:[NSArray arrayWithObjects:@"Song title",@"Artist name",nil] forKeys:[NSArray arrayWithObjects: MPMediaItemPropertyTitle,MPMediaItemPropertyArtist,nil]]; 
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:info]; 

다음 가져올 수 있는지 확인 : 다음과 같다 사전에

#import <MediaPlayer/MPNowPlayingInfoCenter.h> 
#import <MediaPlayer/MPMediaItem.h> 
#import <MediaPlayer/MPMediaQuery.h> 

키 :

MPMediaItemPropertyAlbumTitle 
MPMediaItemPropertyAlbumTrackCount 
MPMediaItemPropertyAlbumTrackNumber 
MPMediaItemPropertyArtist 
MPMediaItemPropertyArtwork 
MPMediaItemPropertyComposer 
MPMediaItemPropertyDiscCount 
MPMediaItemPropertyDiscNumber 
MPMediaItemPropertyGenre 
MPMediaItemPropertyPersistentID 
MPMediaItemPropertyPlaybackDuration 
MPMediaItemPropertyTitle 
MPNowPlayingInfoPropertyElapsedPlaybackTime 
MPNowPlayingInfoPropertyPlaybackRate; 
MPNowPlayingInfoPropertyPlaybackQueueIndex; 
MPNowPlayingInfoPropertyPlaybackQueueCount; 
MPNowPlayingInfoPropertyChapterNumber; 
MPNowPlayingInfoPropertyChapterCount; 

소스 :

https://developer.apple.com/library/ios/documentation/mediaplayer/reference/MPNowPlayingInfoCenter_Class/Reference/Reference.html

+0

대답 해 주셔서 감사합니다. – Sophea

+0

@Ben, 그 코드가 여전히 작동하지 않는 이유는 무엇입니까? –

+0

@Victor M, 음, 코드는 사용자가 원격 이벤트에 등록하고 사용 가능한 백그라운드 오디오로 오디오 세션을 가져 왔으며 plist 파일 세트의 배경 오디오에 대한 멀티 태스킹 플래그가 있다고 가정합니다. 그게 도움이 되니? 그렇지 않다면, 당신은 당신의 구현을 보여줄 수 있고 나는 무엇이 잘못되었는지 보려고 할 수 있습니다. – Ben