0

当我在应用程序中点击播放/暂停时,我想更改锁定屏幕上的播放/暂停按钮图标。

当我从锁定屏幕点击播放/暂停时,我会在应用程序中收到它并更新视图,但是当我在应用程序中点击它时,它不会在锁定屏幕上更新。

我试图这样做:

NSMutableDictionary *currentlyPlayingTrackInfoDict = [[NSMutableDictionary alloc] initWithCapacity:3];

[currentlyPlayingTrackInfoDict setObject:[NSNumber numberWithFloat:[[AudioPlaybackManager shared] isPlaying] ? 1.0f : 0.0f] forKey:MPNowPlayingInfoPropertyPlaybackRate];
[currentlyPlayingTrackInfoDict setObject:[NSNumber numberWithFloat:10.0] forKey:MPNowPlayingInfoPropertyElapsedPlaybackTime];
[currentlyPlayingTrackInfoDict setObject:[NSNumber numberWithFloat:100.0] forKey:MPMediaItemPropertyPlaybackDuration];

[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:currentlyPlayingTrackInfoDict];

但它只影响搜索栏。

有没有人遇到过类似的问题?我应该设置其他东西吗?

4

0 回答 0