开发者

Setting MPMoviePlayer controlStyle to MPMovieControlStyleNone crashes app

I have an app which uses a manager to offer up the relevant custom view for a selected item when selected.

The selection is done through one of 3 parent custom views

  • TableView
  • PageControl
  • Gallery (essentially another TableView)

One of the custom views displays a view with an embedded MPMovieControl on it.

This works fine however for some reason in the Gallery view if I have set the controlStyle of the video set to MPControlStyleNone the app crashes, well it locks up the simulator and Xcodes debugger doesnt even notice, just assumes its still running.

This lin开发者_高级运维e is the culprit

player.controlStyle = MPMovieControlStyleNone;

Without it, it works fine, but then I obviously have the unrequired controls displayed


iOS 2.0 through iOS 3.1 uses movieControlMode. Everything newer uses controlStyle. Test for newer and fall back to older.

   if ([movie respondsToSelector:@selector(setControlStyle:)]) {
        movie.controlStyle = MPMovieControlStyleNone;
    } else {
        movie.movieControlMode = MPMovieControlModeHidden;
    }


May be this will work.

[player setControlStyle:MPMovieControlStyleNone];


Run the program using the profiler and check for NSZombies. Most likely the app is crashing due to a wrong release count or an autorelease and the symptom is your movie crashing when it might be something related to you starting the movie and needing it later to find it was released.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜