jpsim / JPSVolumeButtonHandler

JPSVolumeButtonHandler provides an easy block interface to hardware volume buttons on iOS devices. Perfect for camera apps!
MIT License
333 stars 90 forks source link

first run issue #55

Open nivbp7 opened 6 years ago

nivbp7 commented 6 years ago

Hi, I'm trying to use the code, but can't seem to get it to run.

This is the code:

`

import "ViewController.h"

import "JPSVolumeButtonHandler.h"

@interface ViewController ()

@property (nonatomic,strong) JPSVolumeButtonHandler *volumeButtonHandler;

@end

@implementation ViewController

-(void)viewWillAppear:(BOOL)animated{ [super viewWillAppear:animated]; [self.volumeButtonHandler stopHandler]; [self.volumeButtonHandler startHandler:YES]; [NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(takePhoto) userInfo:nil repeats:NO];

}

-(void)takePhoto{ NSLog(@"takePhoto"); self.volumeButtonHandler = [JPSVolumeButtonHandler volumeButtonHandlerWithUpBlock:^{ // Volume Up Button Pressed NSLog(@"Volume Up Button Pressed");

} downBlock:^{
    // Volume Down Button Pressed
    NSLog(@"Volume Down Button Pressed");

}];

} @end `