Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MPVolumeView not showing in iOS Simulator

This code works fine on a physical iPhone 6, but on iOS simulator the MPVolumeView doesn't show.

- (void)setUpVolumeView
{    
    CGRect sliderRect = CGRectMake(20, 400, 300, 20);
    self.myVolumeView = [[MPVolumeView alloc] initWithFrame:sliderRect];
    [self.view addSubview: self.myVolumeView];
}

self is in this case a ViewController.

Anyone know why this happens?

like image 798
HenryRootTwo Avatar asked Apr 21 '15 21:04

HenryRootTwo


2 Answers

MPVolumeView has, as far back my memory goes, never worked in the simulator. It's always either shown nothing or displayed "No volume available" in white text.

like image 142
bgilham Avatar answered Sep 22 '22 14:09

bgilham


It doesn't work because it has to reflect the system value which is not controllable through the simulator (i.e no volume hardware buttons as there are on the actual device).

like image 27
jkdorman Avatar answered Sep 21 '22 14:09

jkdorman