当我在真实设备上测试我的收音机 iOS 应用程序时遇到问题,它运行良好,但是当屏幕或设备关闭时,收音机停止并关闭,为什么会发生这种情况?以及如何使活动指示器视图停止移动并在收音机打开并完成加载时隐藏它???
(void)viewDidLoad
{
[super viewDidLoad];
timer=[NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(uodatetimer) userInfo:nil repeats:YES];
player = [[MPMoviePlayerController alloc] initWithContentURL:
[NSURL URLWithString:@"http://46.43.64.50:8008/AJYAL.m3u"]];
player.movieSourceType = MPMovieSourceTypeStreaming;
player.view.hidden = YES;
[self.view addSubview:player.view];
[player prepareToPlay];
[player play];
// player.useApplicationAudioSession=NO;
spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
spinner.frame = CGRectMake(0.0, 0.0, 20.0, 20.0);
spinner.center=self.view.center;
[spinner startAnimating];
[self.view addSubview:spinner];
MPVolumeView *volumeView = [[[MPVolumeView alloc] initWithFrame:
CGRectMake(0, 0, 105, 15)] autorelease];
volumeView.center = CGPointMake(152,372);
[volumeView setShowsVolumeSlider:YES];
[volumeView setShowsRouteButton:YES];
[volumeView sizeToFit];
[self.view addSubview:volumeView];
}