浏览代码

fix by just start capture session on non-simulators

nayooti 5 年之前
父节点
当前提交
5d90b2bb5f
共有 1 个文件被更改,包括 7 次插入3 次删除
  1. 7 3
      deltachat-ios/Controller/QrCodeReaderController.swift

+ 7 - 3
deltachat-ios/Controller/QrCodeReaderController.swift

@@ -68,7 +68,7 @@ class QrCodeReaderController: UIViewController {
     }
 
     override func viewWillAppear(_ animated: Bool) {
-        
+        startSession()
     }
 
     override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
@@ -82,7 +82,7 @@ class QrCodeReaderController: UIViewController {
     }
 
     override func viewWillDisappear(_ animated: Bool) {
-        captureSession.stopRunning()
+        stopSession()
     }
 
     // MARK: - setup
@@ -128,8 +128,12 @@ class QrCodeReaderController: UIViewController {
 
     // MARK: - actions
     func startSession() {
+        #if targetEnvironment(simulator)
+        // ignore if run from simulator
+        #else
         captureSession.startRunning()
-    }
+        #endif
+        }
 
     func stopSession() {
         captureSession.stopRunning()