Is there more to getting this working than the readme says?
I'm just doing a quick test prototype to make sure that I can in fact respond to volume buttons presses. I installed VolumeButtonHandler via Cocoapods, ensured that my project sees it and implemented the following as a test in ViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
self.outputLabel.text = @"";
self.volumeHandler = [JPSVolumeButtonHandler volumeButtonHandlerWithUpBlock:^{
self.outputLabel.text = @" Up! ";
} downBlock:^{
self.outputLabel.text = [self.outputLabel.text stringByAppendingString:@" Down! "];
}];
}
When I load it up on my iPhone6, It doesn't print anything to my label upon pressing vol up or down
Me too, don't know what's going on here
I had the same issue a while ago and found that you need to call:
[self.volumeHandler start];
after you initialize the volumeHandler. (I'm doing it in swift, so I'm guessing about the method signature for Obj-C). You should also do:
[self.volumeHandler stop]; self.volumeHandler = nil;
in something like the viewDidDisappear() or similar, depending on your usage.