2011-07-20 8 views
6

iPadアプリでビデオ(m4v)を1ページで再生しているときに別のビデオを再生する別のView Controllerに移動します。 正常に再生されますが、2番目のビデオの再生が終了すると、アサーションの失敗がスローされます。アサーションに失敗しました:ムービープレーヤーの起動状態が間違っています(1)

エラーは、次のとおりです。私はこのエラーを取得するなぜ

*** Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:], /SourceCache/MobileMusicPlayer_Sim/MobileMusicPlayer-1137.39/SDK/MPMoviePlayerController.m:1236 
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'movie player <MPMoviePlayerControllerNew: 0x623f6b0> has wrong activation state (1)' 
*** Call stack at first throw: 
(
0 CoreFoundation      0x015e35a9 __exceptionPreprocess + 185 
1 libobjc.A.dylib      0x01737313 objc_exception_throw + 44 
2 CoreFoundation      0x0159bef8 +[NSException raise:format:arguments:] + 136 
3 Foundation       0x001ea3bb -[NSAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 116 
4 MediaPlayer       0x00522850 -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:] + 204 
5 Foundation       0x00159669 _nsnote_callback + 145 
6 CoreFoundation      0x015bb9f9 __CFXNotificationPost_old + 745 
7 CoreFoundation      0x0153a93a _CFXNotificationPostNotification + 186 
8 Foundation       0x0014f20e -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 
9 MediaPlayer       0x00521e08 -[MPMoviePlayerControllerNew _postNotificationName:object:] + 56 
10 MediaPlayer       0x005293f7 -[MPMoviePlayerControllerNew _ensureActive] + 158 
11 MediaPlayer       0x005242e8 -[MPMoviePlayerControllerNew setControlStyle:] + 45 
12 Restore Sensor      0x00073cfe -[MRSPresentationSlide2 viewDidLoad] + 334 
13 UIKit        0x00958089 -[UIViewController view] + 179 
14 Restore Sensor      0x00071ed8 -[MRSPresentationController pushViewOnScreen:] + 632 
15 Restore Sensor      0x0007395d -[MRSPresentationSlide1 moviePlayBackDidFinish:] + 365 
16 Foundation       0x00159669 _nsnote_callback + 145 
17 CoreFoundation      0x015bb9f9 __CFXNotificationPost_old + 745 
18 CoreFoundation      0x0153a93a _CFXNotificationPostNotification + 186 
19 Foundation       0x0014f20e -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 
20 MediaPlayer       0x00521d24 -[MPMoviePlayerControllerNew _postDidFinishNotificationWithUserInfo:] + 69 
21 Foundation       0x00159669 _nsnote_callback + 145 
22 CoreFoundation      0x015bb9f9 __CFXNotificationPost_old + 745 
23 CoreFoundation      0x0153a93a _CFXNotificationPostNotification + 186 
24 Foundation       0x0014f20e -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 
25 MediaPlayer       0x0053d974 -[MPAVController _itemPlaybackDidEndNotification:] + 491 
26 Foundation       0x00159669 _nsnote_callback + 145 
27 CoreFoundation      0x015bb9f9 __CFXNotificationPost_old + 745 
28 CoreFoundation      0x0153a93a _CFXNotificationPostNotification + 186 
29 Foundation       0x0014f20e -[NSNotificationCenter postNotificationName:object:userInfo:] + 134 
30 Celestial       0x025907a7 -[NSObject(NSObject_AVShared) postNotificationWithDescription:] + 176 
31 Celestial       0x02594a7d -[AVController itemHasFinishedPlayingNotification:] + 169 
32 Celestial       0x025989ca -[AVController fpItemNotification:sender:] + 2177 
33 Celestial       0x025a2a8d -[AVPlaybackItem fpItemNotificationInfo:] + 1473 
34 Celestial       0x02590f51 -[AVObjectRegistry safeInvokeWithDescription:] + 211 
35 Foundation       0x0016e94e __NSThreadPerformPerform + 251 
36 CoreFoundation      0x015c48ff __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 15 
37 CoreFoundation      0x0152288b __CFRunLoopDoSources0 + 571 
38 CoreFoundation      0x01521d86 __CFRunLoopRun + 470 
39 CoreFoundation      0x01521840 CFRunLoopRunSpecific + 208 
40 CoreFoundation      0x01521761 CFRunLoopRunInMode + 97 
41 GraphicsServices     0x0304f1c4 GSEventRunModal + 217 
42 GraphicsServices     0x0304f289 GSEventRun + 115 
43 UIKit        0x008b6c93 UIApplicationMain + 1160 
44 Restore Sensor      0x00002121 main + 177 
45 Restore Sensor      0x00002065 start + 53 
) 
terminate called throwing an exception 

誰もが知っていますか?

答えて

6

問題が見つかりました。 最初のビデオはMPMoviePlayerPlaybackDidFinishNotification通知を削除していないため、2番目のビデオが複数回読み込まれていました。

+6

私は同じ問題があります。しかし、どうやってこれを解決しましたか? – dhilipsiva

1

MoviePlayersが複数ある場合は、その正確なプレーヤーにのみ通知してください。例:

NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; 
[center addObserver:self 
      selector:@selector(moviePlaybackStateChanged:) 
       name:MPMoviePlayerPlaybackDidFinishNotification 
      object:self.movieController]; 

これは、正しいプレーヤーからの通知のみを受信することを確認します。
それは少なくとも私のためにそれを修正しました。

+0

こんにちは、私は通知のために登録していませんが、同じエラー(クラッシュ)を取得しています。助けてもらえますか?前もって感謝します。 – Unheilig

0

プレーヤーを停止してから、もう一度初期化してください。

[PlayerName Stop];

関連する問題