How can I make the iPhone 4 LED light fire instantly?

余生颓废 提交于 2019-11-28 23:49:10
hotpaw2

Do everything (all the session and device configuration stuff) except the flash configuration block before you want to turn the flash LED on, during app init or view load.

Then just set torch mode on when you want to turn the LED on. Something like:

[self.myDevice lockForConfiguration:nil];
[self.myDevice setTorchMode:AVCaptureTorchModeOn];
[self.myDevice setFlashMode:AVCaptureFlashModeOn];
[self.myDevice unlockForConfiguration];

Make sure that myDevice is a properly configured property during your init.

A bit necromantic, but here is a great Library to do it :

LARSTTorch

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!