如何显示iOS应用程序正在锁定屏幕上录制音频

如何显示iOS应用程序正在锁定屏幕上录制音频,ios,avaudiorecorder,lockscreen,mpnowplayinginfocenter,Ios,Avaudiorecorder,Lockscreen,Mpnowplayinginfocenter,我有一个录音应用程序。如何显示应用程序在锁定屏幕打开时正在录制,就像iPhone附带的语音备忘录应用程序那样。尝试使用MPNowPlayingFoCenter玩,但没有任何效果。有什么想法吗 下面是我在开始录制的iAction中尝试实现的内容 Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); if (playingInfoCenter) { NSMutableDictionary *son

我有一个录音应用程序。如何显示应用程序在锁定屏幕打开时正在录制,就像iPhone附带的语音备忘录应用程序那样。尝试使用MPNowPlayingFoCenter玩,但没有任何效果。有什么想法吗

下面是我在开始录制的iAction中尝试实现的内容

Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");

if (playingInfoCenter) {


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


    MPMediaItemArtwork *albumArt = [[MPMediaItemArtwork alloc] initWithImage: [UIImage imageNamed:@"record.png"]];

    [songInfo setObject:@"Recording" forKey:MPMediaItemPropertyTitle];
    [songInfo setObject:albumArt forKey:MPMediaItemPropertyArtwork];
    [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];


}

试试这个:是的,这就完成了这个技巧,我仍然想找到一种方法在锁屏上获取录制的经过时间。不确定该怎么办。这取决于您想把它放在哪里-您可以显示
MPMediaItemPropertyArtist
的字符串作为经过的时间嘿,您这样做成功了吗?我可以在使用CategoryPlayback时显示MPNowPlayingFocenter,但当然你不能用它录制。我也取得了一些成功,通过使用CategoryRecordAndPlay,开始录制,然后切换到CategoryPlayback并显示MPNowPlayingFoCenter,但这只发生在我第一次运行应用程序时,之后,如果我停止并重新启动录制,它将不再显示。。。