Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPMoviePlayerController undeclared (first use in the function) message

Tags:

iphone

I dont know why I am getting this message when I click have this code

MPMoviePlayerController *mp = [[MPMoviePlayerController alloc] iniWithContentURL: url];

Is there something, I am missing here?

Thanks

like image 577
iosdevnyc Avatar asked Oct 15 '09 21:10

iosdevnyc


3 Answers

You need to import/include the movie player:

#import <MediaPlayer/MediaPlayer.h>

Furthermore, the MediaPlayer.framework must be added to your "Frameworks" folder in the XCode project. To add the framework, right-click on "Frameworks", then select the path on your system where this framework resides. On my system it is under the following path:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk/System/Library/MediaPlayer.framework

like image 65
pythonquick Avatar answered Oct 22 '22 20:10

pythonquick


Make sure you are linking to MediaPlayer.framework in your Xcode project. That's where MPMoviePlayerController comes from and if you don't link to it, the linker won't know what it is.

like image 44
Marc W Avatar answered Oct 22 '22 20:10

Marc W


MediaPlayer.framework must be added to your "Frameworks" and #import <MediaPlayer/MediaPlayer.h> in your .h file

like image 35
rajasekhar Avatar answered Oct 22 '22 21:10

rajasekhar