iphone - 为什么链接器提示缺少符号?

标签 iphone cocoa linker

为什么我会收到这个奇怪的错误? alt text http://img266.imageshack.us/img266/2203/help.tif 有什么想法吗?

实现:

#import "VideoView.h"
#import <MediaPlayer/MediaPlayer.h>

@implementation VideoView
@synthesize player;

- (void)playVideoWithURL:(NSURL *)url showControls:(BOOL)showControls {
    if (!player) {
        player = [[MPMoviePlayerController alloc] initWithContentURL:url];

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didFinishPlaying:) name:MPMoviePlayerPlaybackDidFinishNotification object:player];

        if (!showControls) {
            player.scalingMode = MPMovieScalingModeAspectFill;
            player.movieControlMode = MPMovieControlModeHidden;
        }

        [player play];
    }
}

- (IBAction)playVideoWithControls {
    NSString *path = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"mov"];
    NSURL *url = [NSURL fileURLWithPath:path];
    [self playVideoWithURL:url showControls:YES];
}


- (void)didFinishPlaying:(NSNotification *)notification {
    if (player == [notification object]) {  
        [[NSNotificationCenter defaultCenter] removeObserver:self name:MPMoviePlayerPlaybackDidFinishNotification object:player];
        [player release];
        player = nil;
    }
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
    // Release anything that's not essential, such as cached data
}


- (void)dealloc {
    [super dealloc];
}


@end

标题:

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>


@interface VideoView : UIViewController {
    MPMoviePlayerController *player;

}
@property (nonatomic, retain) MPMoviePlayerController *player;
- (IBAction)playVideoWithControls;


@end

最佳答案

MPMoviePlayerController 位于您忘记链接到的 MediaPlayer.framework 中。

关于iphone - 为什么链接器提示缺少符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/961267/

相关文章:

iphone - 如何在 UITableView 透明 header 下屏蔽 UITableViewCells

iphone - 我得到了一个 EXC_BAD_ACCESS,我似乎无法找出原因

cocoa - 重命名时不会加载核心数据模型文件

c - MAP 文件不包含内联函数

c++ - 构建时的 Microsoft C++ 库符号链接(symbolic link)

javascript - 以编程方式在 UIWebView 中显示键盘

iphone - 将多个异步调用放入队列中

macos - Yosemite 中的沙盒问题 (OSX 10.10)

cocoa - 复制的 Cocoa Framework 仅搜索/Library/Frameworks/...。我怎样才能让它在自身内部搜索二进制?

c++ - Visual Studio 静态链接(freeglut,glew)