Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Is there more to getting this working than the readme says? #17

Open
dtirer opened this issue Nov 25, 2015 · 2 comments
Open

Is there more to getting this working than the readme says? #17

dtirer opened this issue Nov 25, 2015 · 2 comments

Comments

@dtirer
Copy link

dtirer commented Nov 25, 2015

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

@X140Yu
Copy link

X140Yu commented Jan 18, 2017

Me too, don't know what's going on here

@creitz
Copy link

creitz commented Jan 18, 2017

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants