MPMoviePlayerController not playing any video content [due to ARC and memory management]

后端 未结 2 935
礼貌的吻别
礼貌的吻别 2020-12-06 13:21

I am trying to get a video playing in an iOS applocation, using MPMoviePlayerController to append a movie-view to an existing view when a user pushes a button. The view appe

2条回答
  •  忘掉有多难
    2020-12-06 13:59

    As with my answer to MPMoviePlayerController playback terminates before video finishes, this looks to be a memory management (instance lifetime) issue. Assuming you are compiling with ARC, the player variable is released when your playButtonClicked: method returns. At that point the MPMoviePlayerController instance takes its bat and ball, and goes home.

    Try assigning the MPMoviePlayerController instance to a strong instance variable or property.

提交回复
热议问题