gpt4 book ai didi

ios - MPNowPlayingInfoCenter 在 iOS 8 中不显示媒体信息

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:08:38 25 4
gpt4 key购买 nike

我尝试使用此代码在锁屏和控制中心显示媒体信息,但它没有显示任何内容:

Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");

if (playingInfoCenter) {


NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];


MPMediaItemArtwork *albumArt = [[MPMediaItemArtwork alloc] initWithImage: [UIImage imagedNamed:@"AlbumArt"]];

[songInfo setObject:@"Audio Title" forKey:MPMediaItemPropertyTitle];
[songInfo setObject:@"Audio Author" forKey:MPMediaItemPropertyArtist];
[songInfo setObject:@"Audio Album" forKey:MPMediaItemPropertyAlbumTitle];
[songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
[[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];

}

我也设置了 FirstResponding 但仍然没有看到任何东西。

- (void) viewDidAppear: (BOOL) animated
{
[super viewDidAppear:animated];
[self becomeFirstResponder];
NSLog(@"is first resp: %i",[self isFirstResponder]);

[[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
// Initialize the AVAudioSession here.

[[UIApplication sharedApplication] endReceivingRemoteControlEvents];

}

- (BOOL) canBecomeFirstResponder
{
return YES;
}

我该如何解决?谢谢

最佳答案

您是否激活了“音频、AirPlay 和画中画”,如下所示?

enter image description here

关于ios - MPNowPlayingInfoCenter 在 iOS 8 中不显示媒体信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35055545/

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