Browse Source

fix by just start capture session on non-simulators

nayooti 5 years ago
parent
commit
5d90b2bb5f
1 changed files with 7 additions and 3 deletions
  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()