首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >iOS 8.4 MPNowPlayingInfoCenter跳跃/prev消失

iOS 8.4 MPNowPlayingInfoCenter跳跃/prev消失
EN

Stack Overflow用户
提问于 2015-07-08 21:04:01
回答 1查看 909关注 0票数 6

我正在开发一个音乐播放应用程序,在以前的iOS版本中,媒体播放器会显示播放/暂停以及跳过按钮和prev按钮。现在,使用8.4更新,所显示的只是播放/暂停。我正在按照通常的方式更新MPNowPlayingInfoCenter:

代码语言:javascript
复制
NSDictionary* nowPlayingInfo = @{
    MPMediaItemPropertyTitle:[self.currentSong title],
    MPMediaItemPropertyArtist:[self.currentSong artist],
    MPMediaItemPropertyPlaybackDuration:[NSNumber numberWithDouble:(double) self.duration],
    MPNowPlayingInfoPropertyElapsedPlaybackTime: [NSNumber numberWithDouble:(double)self.currentPlaybackTime],
    MPNowPlayingInfoPropertyPlaybackRate: self.isPlaying ? @1.0 : @0.0,
    MPMediaItemPropertyArtwork: mediaPlayerArtwork,
    MPNowPlayingInfoPropertyPlaybackQueueIndex: [NSNumber numberWithInteger:playQueue.queuePosition],
    MPNowPlayingInfoPropertyPlaybackQueueCount: [NSNumber numberWithInteger:playQueue.queueIDs.count] };
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:nowPlayingInfo];

但结果是..。

谢谢你的帮助!

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-07-10 00:05:43

为了返回下一个按钮和prev按钮,您需要添加:

代码语言:javascript
复制
[[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)];
[[MPRemoteCommandCenter sharedCommandCenter].previousTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)];

我在AppDelegate的

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

如果您已经接收到远程事件,则操作方法可以为空:

-(void) remoteNextPrevTrackCommandReceived:(id)event {}

票数 5
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/31303695

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档