Skip to main content


Showing posts from November, 2014

How to turn on flash light in iOS

- ( void ) setTorchOn:( BOOL )isOn {     AVCaptureDevice * device = [ AVCaptureDevice defaultDeviceWithMediaType : AVMediaTypeVideo ];     [device lockForConfiguration : nil ]; //you must lock before setting torch mode     [device setTorchMode :isOn ? AVCaptureTorchModeOn : AVCaptureTorchModeOff ];     [device unlockForConfiguration ]; } Pass a bool value to above method. If we pass YES then the flash light will glow. EXE: [self setTorchOn:YES]; If we pass NO then the flash light will stop glowing. EXE: [self setTorchOn:NO];