[英]Flash is Not Working in iPhone 6S with iOS 11.2.2
When I'm running the app in iPhone 6S with iOS 11.2.2. 当我在带有iOS 11.2.2的iPhone 6S中运行该应用程序时。 The Flash is not working. 闪光灯无法正常工作。 Toggle button is working fine ie, On/Off. 切换按钮工作正常,即开/关。 But, Flash is not coming when the toggle is On. 但是,当切换开关打开时,Flash不会出现。
- (void)toggleFlash{
NSArray *devices = [AVCaptureDevice devices];
for (AVCaptureDevice *device in devices){
if (device.flashAvailable) {
if (flashOn){
[device lockForConfiguration:nil];
[device isTorchModeSupported:AVCaptureTorchModeOn];
[device unlockForConfiguration];
}
else{
[device lockForConfiguration:nil];
[device isTorchModeSupported:AVCaptureTorchModeOff];
[device unlockForConfiguration];
}
}
}
}
Done with the debugging.. It's working fine. 完成调试工作。 But, Issue with Flash. 但是,Flash问题。 Anyone Working on this issue. 解决此问题的任何人。 Please help me out? 请帮帮我吗?
Your code only checks whether torch mode is available ( isTorchModeSupported
) but never turns on the torch. 您的代码仅检查割炬模式是否可用( isTorchModeSupported
),而不会打开割炬。 You can use setTorchModeOn
for that, 您可以setTorchModeOn
使用setTorchModeOn
,
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.