Iphone 无法在iOS 4.3中使用MPMovieAccessLog

Iphone 无法在iOS 4.3中使用MPMovieAccessLog,iphone,mpmovieplayercontroller,Iphone,Mpmovieplayercontroller,我正在尝试从MPMoviePlayerController(在iOS 4.3中)获取accesslog。但每次都是零。我正在使用URL播放视频。请说明我做错了什么或与参考资料有什么不同 -(void)playMovie:(id)对象 { NSURL*aURL=[NSURL URLWithString:@”http://www.example.com/videos/video1.mp4"]; NSLog(@“URL%@”,aURL); movie=[[MPMoviePlayerController

我正在尝试从MPMoviePlayerController(在iOS 4.3中)获取accesslog。但每次都是零。我正在使用URL播放视频。请说明我做错了什么或与参考资料有什么不同

-(void)playMovie:(id)对象
{
NSURL*aURL=[NSURL URLWithString:@”http://www.example.com/videos/video1.mp4"];
NSLog(@“URL%@”,aURL);
movie=[[MPMoviePlayerController alloc]init];
[移动设置内容URL:aURL];
movie.scalingMode=MPMovieScalingModeAspectFill;
[theMovie.view setFrame:self.view.bounds];
[self.view addSubview:theMovie.view];
计时器=[NSTimer scheduledTimerWithTimeInterval:5目标:自选择器:@selector(getData:)userInfo:nil repeats:YES];
[电影剧];
}
-(void)getData:(NSTimer*)对象
{
NSLog(@“-----日志记录开始----------------”);
MPMovieAccessLog*accessL=[TheMovieAccessLog];
NSArray*events=accessL.events;
对于(int i=0;i文档说明:

电影访问日志会累积密钥 关于网络播放的度量标准 关联的电影播放器,即 播放流媒体内容

因此,此功能仅适用于流媒体内容(如HLS视频)


请看,它指定了电影文件的类型。

播放完成/结束/停止后,请尝试使用accesslog。仍然获得零值?每次都是零,因为MPMovieSourceType是文件。
-(void) playMovie:(id) object
{
    NSURL *aURL=[NSURL     URLWithString:@"http://www.example.com/videos/video1.mp4"];
    NSLog(@"URL %@",aURL);
    theMovie=[[MPMoviePlayerController alloc] init ];
    [theMovie setContentURL:aURL];
   theMovie.scalingMode= MPMovieScalingModeAspectFill;
    [theMovie.view setFrame:self.view.bounds];
    [self.view addSubview:theMovie.view];
    timer =[NSTimer scheduledTimerWithTimeInterval:5 target:self     selector:@selector(getData:) userInfo:nil repeats:YES];
    [theMovie play];
}

-(void) getData:(NSTimer*) object
{
    NSLog(@"------------Loggging start-------------");
    MPMovieAccessLog *accessL=[theMovie accessLog];
    NSArray *events = accessL.events;
    for (int i=0; i<[events count]; i++) {
        NSLog(@"-  %@",[events objectAtIndex:i]);
    }
    NSLog(@"------------Loggging end-------------");
}