0

xcode gives me that error:

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)

this is viewDidload of viewcontroller.

- (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];
}

I import:

#import <MediaPlayer/MPVolumeView.h>

What could be the error?

odemolliens
  • 2,581
  • 2
  • 32
  • 34
Jayyrus
  • 12,961
  • 41
  • 132
  • 214

2 Answers2

3

Add MediaPlayer framework in your project:

Project -> Build phases -> Link binary with libraries:

enter image description here

odemolliens
  • 2,581
  • 2
  • 32
  • 34
2

The error says that the linker cannot find the class MPVolumeView

You need to add the library or framework that includes this class to XCode

mmmmmm
  • 32,227
  • 27
  • 88
  • 117