Search code examples
iospointersmpmovieplayercontrollermpmovieplayer

Incompatible pointer- MPMoviePlayer from URL


I have an NSArray that loads video files from XML data. When you press an Array item, it loads a view with a button that should load the NSString url. Here's the code I'm working with.

-(IBAction)playMovie:(id)sender
    {
        RSSItem* item = (RSSItem*)self.description;
        NSURL *movieUrl = [NSURL URLWithString: item];
        MPMoviePlayerController *moviePlayerController = [[MPMoviePlayerController alloc] initWithContentURL:movieUrl];
        [self.view addSubview:moviePlayerController.view];
        moviePlayerController.fullscreen = YES;
        [moviePlayerController play]; 
    }

I am getting the warning "Incompatible pointer types sending 'RSSItem *_strong' to parameter of type 'NSString *'

I have tried everything that I can think of to convert the string to a string and get it to work. Please let me know if this question is too specific or basic for the forum.

Thanks!


Solution

  • This:

    RSSItem* item = (RSSItem*)self.description;

    should be this:

    NSString* item = self.description;

    The above line in your code is puzzling and troubling. Why are you trying to cast description (which is an NSString to begin with) to an RSSItem?