1
我嘗試從一個HTTP服務器以流的mp4-文件到我的iPhone與此代碼:iOS的電影流正常工作在模擬器,但不是在設備
- (IBAction)streamMovie:(id)sender
{
NSURL *url = [NSURL URLWithString:trailerPath];
if ([self.movieController respondsToSelector:@selector(setAllowsAirPlay:)])
[self.movieController.moviePlayer setAllowsAirPlay:YES];
[self.movieController.moviePlayer setContentURL:url];
[self presentMoviePlayerViewControllerAnimated:self.movieController];
[self.movieController.moviePlayer play];
}
也能正常工作在模擬器上,但在我的iPhone設備(iOS 5.1的3GS)上完全不起作用。電影播放器只彈出,然後立即消失。如果我再試一次這個日誌條目出現:
An instance 0x1c5a20 of class AVPlayerItem was deallocated while key value observers
were still registered with it. Observation info was leaked, and may even become
mistakenly attached to some other object. Set a breakpoint on NSKVODeallocateBreak to
stop here in the debugger. Here's the current observation info:
我在做什麼錯,爲什麼這個工作在模擬器上?