I tried for many hours now to try and get my application to work. The problem is that after the app detects a QR-code, it does not show the new view controller. It will perform a simple print statement in that new view controller to the log, but there is no new view controller present in the app. I tried many solutions already on Stackoverflow, but none seems to be helping in this specific case.
func captureOutput(_ captureOutput: AVCaptureOutput!, didOutputMetadataObjects metadataObjects: [Any]!, from connection: AVCaptureConnection!) {
captureSession.stopRunning()
if let metadataObject = metadataObjects.first {
let readableObject = metadataObject as! AVMetadataMachineReadableCodeObject;
AudioServicesPlaySystemSound(SystemSoundID(kSystemSoundID_Vibrate))
found(code: readableObject.stringValue);
}
let vc = infoViewController()
self.present(vc, animated: true, completion: nil)
I Use the last to lines to point to the new infoViewController the app is supposed to go to after scanning a QR-code. The code in the infoViewController is as follows:
import UIKit
class infoViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
print("Hi")
}
The Log does show the print statement "Hi", but the application does not go to the infoViewController. The storyboard also has the infoViewController in it, with the class infoViewController selected.
Is there a detail that I'm missing currently?
Greetings