2012-01-27 56 views
6

MPMoviePlayerController成功播放airPlay,當我進入主屏幕並且應用程序在後臺時。但是當我雙擊主頁按鈕時,應用程序崩潰。這發生在iOS 5上,但不是在4.3上。MPMoviePlayerController在後臺播放airPlay,雙擊主頁按鈕時崩潰

要排除其他代碼,我創建了一個新的空項目,只執行按鈕按下時的代碼。

moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString:@"http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8"]]; 

NSError *setCategoryError = nil; 
[[AVAudioSession sharedInstance] setCategory: AVAudioSessionCategoryPlayback error: &setCategoryError]; 

[[NSNotificationCenter defaultCenter] addObserver:self 
             selector:@selector(moviePlaybackComplete:) 
              name:MPMoviePlayerPlaybackDidFinishNotification 
              object:moviePlayerController]; 

[moviePlayerController setMovieSourceType:MPMovieSourceTypeStreaming]; 
[self addObservers]; 
[self.delegate addSubview:moviePlayerController.view]; 
if([moviePlayerController respondsToSelector:@selector(setAllowsAirPlay:)]) 
{ 
    [moviePlayerController setAllowsAirPlay:YES]; 
} 

moviePlayerController.fullscreen = YES; 

moviePlayerController.scalingMode = MPMovieScalingModeAspectFit; 
[moviePlayerController prepareToPlay]; 
[moviePlayerController play]; 

在控制檯中我得到的崩潰以下的輸出:

Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<<FIGSERVER>>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received to terminate [295] with reason 'fig rpc timeout -- FigSharedRemote_VolumeCategoryForAudioCategory' 
Jan 27 12:08:01 unknown ReportCrash[308] <Notice>: MS:Notice: Installing: (null) [ReportCrash] (675.00) 
Jan 27 12:08:01 unknown ReportCrash[308] <Error>: Saved crashreport to /Library/Logs/CrashReporter/mediaserverd-2012-01-27-120801.plist using uid: 0 gid: 0, synthetic_euid: 0 egid: 0 
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<<FIGSERVER>>>> FigPlayerRemoteServer_KillAndForceCrashReport: RPCTimeout message received; stackshot generated 
Jan 27 12:08:01 unknown mediaserverd[295] <Error>: <<<<FIGSERVER>>>> FigPlayerRemoteServer_KillAndForceCrashReport: TERMINATING our process [295] 
Jan 27 12:08:02 unknown com.apple.launchd[1] <Notice>: (com.apple.mediaserverd) Exited: Killed: 9 
Jan 27 12:08:02 unknown mediaserverd[310] <Notice>: MS:Notice: Installing: com.apple.mediaserverd [mediaserverd] (675.00) 
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd 
Jan 27 12:08:02 unknown kernel[0] <Debug>: Sandbox: ignoring builtin profile for platform app: /usr/sbin/mediaserverd 
Jan 27 12:08:03 unknown mediaserverd[310] <Error>: 12:08:03.383370 com.apple.AVConference: /SourceCache/GameKitServices/GameKitServices-344.3/AVConference.subproj/Sources/AVConferenceServer.m:1862: AVConferenceServerStart aborting - device doesn't support conferencing 

,並在crashreport:

Exception Type: EXC_CRASH (SIGABRT) 
Exception Codes: 0x00000000, 0x00000000 
Crashed Thread: 0 

Last Exception Backtrace: 
0 CoreFoundation     0x33bab8bf 0x33af2000 + 759999 
1 libobjc.A.dylib     0x31bcd1e5 0x31bc4000 + 37349 
2 AVFoundation     0x374f6cb5 -[AVPlayerItem _attachToPlayer:forImmediateEnqueueing:shouldAppendItem:] + 341 
3 AVFoundation     0x374e71f7 -[AVPlayer _insertPlaybackItemOfItem:inPlayerQueueAfterPlaybackItemOfItem:] + 43 
4 AVFoundation     0x374eebf3 __-[AVPlayer _attachItem:andPerformOperation:withObject:]_block_invoke_2 + 1099 
5 libdispatch.dylib    0x3641cd55 0x3641c000 + 3413 
6 libdispatch.dylib    0x36427e8d 0x3641c000 + 48781 
7 CoreFoundation     0x33b7e2dd 0x33af2000 + 574173 
8 CoreFoundation     0x33b014dd 0x33af2000 + 62685 
9 CoreFoundation     0x33b013a5 0x33af2000 + 62373 
10 GraphicsServices    0x31f56fcd 0x31f53000 + 16333 
11 UIKit       0x36d57743 0x36d26000 + 202563 
12 AirplayTest      0x00002e45 main (main.m:16) 
13 AirplayTest      0x00002dd4 start + 40 

任何線索可能是什麼問題?

+0

我有同樣的問題。它不會每次都發生,通常如果我在此期間啓動其他應用程序。我認爲這是由於MPMoviePlayerController的視圖的父視圖在設備需要更多資源時被錯誤地卸載造成的 – reddersky 2012-02-03 18:19:46

+0

當它進入後臺時是否有任何代碼正在運行? – Bot 2012-02-21 17:21:16

+0

也有這個崩潰,你修好了嗎? – 2012-09-03 12:55:03

回答

0

這似乎是iOS 5.0版本中的一個錯誤。隨着iOS 5.1的發佈,它似乎已經修復。

感謝@Cyril對此進行確認。

0

您是否嘗試將iOS 5的電影播放器​​控制器的useApplicationAudioSession屬性設置爲NO(即模擬iOS 3.1默認行爲)?在iOS 5的音頻會話處理中似乎存在一些錯誤,這些錯誤會導致音頻服務器在您切換應用程序,處理中斷等時死亡。

如果此問題得到解決,請向Apple提交錯誤報告,如它更像是一種破解而已!