views:

239

answers:

2

Hi All,

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...

A: 

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

Nikolai Ruhe
A: 

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.

Sidnicious
But the same code is working fine in simulator.
nbojja
@nboja--The simulator is not a perfect replica of the device, especially when it comes to matters of memory allocation.
Nosredna