      */
     func setTorch(torch:Bool)
     {
-        do
-        {
-            try input?.device.lockForConfiguration()
-            
-            input?.device.torchMode = torch ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off            
-            
-            input?.device.unlockForConfiguration()
-        }
-        catch let error as NSError {
-            print("device.lockForConfiguration(): \(error)")
-            
-        }
+        if isGetFlash()
+        {
+            do
+            {
+                try input?.device.lockForConfiguration()
+                
+                input?.device.torchMode = torch ? AVCaptureTorchMode.On : AVCaptureTorchMode.Off
+                
+                input?.device.unlockForConfiguration()
+            }
+            catch let error as NSError {
+                print("device.lockForConfiguration(): \(error)")
+                
+            }
+        }
+        
     }
     
     

        //待测试中途修改是否有效
        output.metadataObjectTypes = objType
    }

    /**
     打开或关闭闪关灯

        videoPreView.layer .insertSublayer(previewLayer!, atIndex: 0)
        
        
        if ( device!.focusPointOfInterestSupported && device!.isFocusModeSupported(AVCaptureFocusMode.ContinuousAutoFocus) )
        {
            do
            {
