Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/104.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
MPNowPlayingFoCenter在iOS 8中不显示媒体信息_Ios_Objective C_Iphone_Media Player_Mpnowplayinginfocenter - Fatal编程技术网

MPNowPlayingFoCenter在iOS 8中不显示媒体信息

MPNowPlayingFoCenter在iOS 8中不显示媒体信息,ios,objective-c,iphone,media-player,mpnowplayinginfocenter,Ios,Objective C,Iphone,Media Player,Mpnowplayinginfocenter,我尝试使用此代码在Lockscreen和Control center中显示媒体信息,但它没有显示任何内容: Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter"); if (playingInfoCenter) { NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init]; MPMediaItemArtwork

我尝试使用此代码在Lockscreen和Control center中显示媒体信息,但它没有显示任何内容:

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;
}
我怎样才能解决这个问题?谢谢

您是否已激活如下所示的“音频、播放和画中画”功能