gpt4 book ai didi

iOS 8.4 MPNowPlayingInfoCenter 跳过/上一个消失

转载 作者:可可西里 更新时间:2023-11-01 03:53:42 26 4
gpt4 key购买 nike

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

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];

但结果是…… enter image description here

enter image description here

感谢您的帮助!

最佳答案

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

[[MPRemoteCommandCenter sharedCommandCenter].nextTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)];
[[MPRemoteCommandCenter sharedCommandCenter].previousTrackCommand addTarget:self action:@selector(remoteNextPrevTrackCommandReceived:)];

我在 AppDelegate 中添加了这个

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

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

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

关于iOS 8.4 MPNowPlayingInfoCenter 跳过/上一个消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31303695/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com