2

Trying to add MPVolumeView programmtically in app by using the following code

 MPVolumeView *_volumeView = [ [MPVolumeView alloc] init];
[_volumeView setShowsVolumeSlider:YES];
[_volumeView setShowsRouteButton:YES];
[_volumeView sizeToFit];
[view addSubview:_volumeView];

but getting so many Semantic issue that use of undeclared identifier MPVolumeView and Invalid operands to binary expression

@property (nonatomic, strong) MPVolumeView *volumeView;

Getting message in red for the above statement that unknown type MPVolumeView and plus property with retain or strong must be of object type.

 @synthesize volumeView = _volumeView;

Is this the right way to add MPVolumeView programmatically in app.

Thanks for help.

user1452248
  • 767
  • 2
  • 11
  • 28
  • 1
    http://developer.apple.com/library/ios/#documentation/AudioVideo/Conceptual/AirPlayGuide/EnrichYourAppforAirPlay/EnrichYourAppforAirPlay.html#//apple_ref/doc/uid/TP40011045-CH6-DontLinkElementID_3 – Borut Tomazin Jan 08 '13 at 14:02

1 Answers1

11

MPVolumeView is part of the MediaPlayer framework. Did you include this in your application and did you #import <MediaPlayer/MediaPlayer.h> in your .m or .h file?

Also, if you declared a property, you should create a new local variable _volumeView. Replace the first line with this:

_volumeView = [ [MPVolumeView alloc] init];
Rengers
  • 14,911
  • 1
  • 36
  • 54