且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何隐藏“正在播放网址"在控制中心

更新时间:2023-02-03 10:31:08

您可以通过

You can control this information with the MPNowPlayingInfoCenter. The defaultCenter's nowPlayingInfo dictionary controls what is displayed about the current audio track on the lock screen and command center.

MPNowPlayingInfoCenter *infoCenter = [MPNowPlayingInfoCenter defaultCenter];

NSDictionary *nowPlayingInfo = @{
                                 MPMediaItemPropertyTitle : @"Media Name",
                                 MPMediaItemPropertyArtist : @"Media Artist"
                                 };

[infoCenter setNowPlayingInfo:[NSDictionary dictionaryWithDictionary:nowPlayingInfo]];

文档中列出了完整的键列表,但是您似乎想将曲目名称设置为空字符串.

The full list of keys are listed in the docs, but it looks like you want to set the track name to the empty string.

MPMediaItemPropertyTitle : @""