Tutorial :MPMoviePlayer crashes in device but works fine in simulator



Question:

In my app i am playing a video using the following code.

    NSURL *myURL = [[NSURL alloc] initWithString:downloadURL];        mMoviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:myURL];        if (mMoviePlayer) {          [self initMoviePlayer];          [mMoviePlayer play];      }  

This code is working fine in simulator, but when i test it in device it is giving "BAD_ACCESS" error. Device is not at all sending the request to video.

Can some one help me with this..

Thanks...


Solution:1

There's nothing wrong with this code. The bug is somewhere else.


Solution:2

BAD_ACCESS generally points to memory management issues: you're trying to access an object that has been deallocated. If you're sure that the crash is happening on the above line, double check that safeURL exists at that point. If it does, you're going to have to post more code for us to give you any pointers.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »