Domanda

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?

È stato utile?

Soluzione

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

Altri suggerimenti

Add MediaPlayer framework in your project:

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

enter image description here

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top