在应用播放音频期间更改LockScreen图像

时间:2013-04-30 13:22:27

标签: ios xcode uiimageview automatic-ref-counting lockscreen

我正在使用单个PLIST文件创建一个具有不同实时流URL的应用程序,当设备使用此代码进行支持时,我在锁定屏幕上启用了远程控制:

- (void)remoteControlReceivedWithEvent: (UIEvent *) receivedEvent {

    if (receivedEvent.type == UIEventTypeRemoteControl) {

        switch (receivedEvent.subtype) {

            case UIEventSubtypeRemoteControlTogglePlayPause:[self playPause:nil];

                break;

            default: break;
        }
    }
}

然后在detailViewController中我调用此函数在锁定屏幕上获取信息:

- (void)viewDidAppear:(BOOL)animated {

    [super viewDidAppear:animated];
    [[UIApplication sharedApplication] beginReceivingRemoteControlEvents];
    [self becomeFirstResponder];

    MPNowPlayingInfoCenter *infoCenter = [MPNowPlayingInfoCenter defaultCenter];
    infoCenter.nowPlayingInfo =
    @{MPMediaItemPropertyTitle: saved[@"title"],MPMediaItemPropertyArtist: saved[@"name"]};

}

我试图插入加号MPMediaItemPropertyArtwork:saved[@"image"]但是应用程序崩溃,任何想法如何解决这个问题,如果你看到我使用ARC编译代码。

感谢。

0 个答案:

没有答案