Jayyrus
Jayyrus

Reputation: 13061

Error in xcode when i try to compile using a MPVolumeView

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?

Upvotes: 1

Views: 1878

Answers (2)

odemolliens
odemolliens

Reputation: 2641

Add MediaPlayer framework in your project:

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

enter image description here

Upvotes: 4

mmmmmm
mmmmmm

Reputation: 32720

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

Upvotes: 2

Related Questions