0

xcode 给了我这个错误:

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_MPVolumeView", referenced from:
  objc-class-ref in VolumeViewController.o
  ld: symbol(s) not found for architecture i386
  clang: error: linker command failed with exit code 1 (use -v to see invocation)

这是 viewcontroller 的 viewDidload。

- (void)viewDidload{
    [super viewDidUnload];
    MPVolumeView *volumeView = [[[MPVolumeView alloc] initWithFrame:CGRectMake(0, 0, 200, 20)] autorelease];
    volumeView.center = CGPointMake(160,134);
    [volumeView sizeToFit];
    volumeView.showsVolumeSlider=YES;
    [self.view addSubview:volumeView];
}

我进口:

#import <MediaPlayer/MPVolumeView.h>

可能是什么错误?

4

2 回答 2

3

在您的项目中添加 MediaPlayer 框架:

项目->构建阶段->将二进制文件与库链接:

在此处输入图像描述

于 2016-03-24T09:33:23.317 回答
2

错误说链接器找不到类 MPVolumeView

您需要将包含此类的库或框架添加到 XCode

于 2011-11-04T22:54:38.333 回答