我知道这种问题一遍又一遍地反复出现,但我无法用我找到的任何答案来解决我的问题:(。
我正在开发一个应用程序,我需要获取音频流。我决定使用 MPMoviePlayer,所以我这样做了:
#import "MediaPlayer/MediaPlayer.h"
@interface FirstViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
...
IBOutlet MPMoviePlayerViewController *theMovie;
...
}
...
@property (nonatomic, retain) MPMoviePlayerViewController *theMovie;
在实现中,我只是 @synthesize-d 它。
现在,每当我分配它并尝试访问它的成员或方法时,我都会在初始化后的第一行收到这个该死的错误unrecognized selector sent to instance :
self.theMovie = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:@"http://netvarp.kringvarp.fo:554/radio/16/playlist.m3u8"]];
self.theMovie.moviePlayer.controlStyle = MPMovieControlStyleNone;
...
(这是在 viewDidLoad 方法中)。
我在这一行得到错误:
self.theMovie.moviePlayer.controlStyle = MPMovieControlStyleNone;
或初始化后我调用的任何内容。
如果我删除 IBOutlet,如果我在没有“自我”的情况下调用它,如果声明一个MPMoviePlayerController ,也是如此。我无法弄清楚我在两天内做错了什么!好尴尬 :(
任何帮助将不胜感激。
我忘了提,目标操作系统 > 3.0。在模拟器上一切正常,但在设备上却不行(iPhone 2G 和 iPhone 3G,都带有 IOS 3.1.3)