title: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x18407cb5c)
body: <p>I keep on getting this error:</p>
  
  <blockquote>
    <p>Thread 1: EXC_BREAKPOINT (code=1, subcode=0x18407cb5c)</p>
  </blockquote>
  
  <p>whenever I run this code:</p>
  
  <pre><code>import UIKit
  import SQLite
  
  class TakeMoney: UIViewController {
      //for json
      let json = "[{"+"\"UserID\":\""+"\(Int(stored_ID) ?? -1)\""+",\"Name\":"+"\"\(stored_name)\""+"}]"
      //
      var img : UIImage? = nil
  
      //variable for image display space
      @IBOutlet weak var ImageDisplay: UIImageView!
      //variable for raw qr image output
      var qrCodeImage : CIImage!
      override func viewDidLoad() {
          super.viewDidLoad()
          print(json)
          ////takes out the input and encodes it
          ///runs on main thread
          DispatchQueue.main.async{
              let data = self.json.data(using: String.Encoding.isoLatin1, allowLossyConversion: false)
              let filter = CIFilter(name: "CIQRCodeGenerator") //defining filter
              filter?.setValue(data, forKey: "inputMessage") //utilising filter
              filter?.setValue("L", forKey: "inputCorrectionLevel") //defining the level of quality, H is highest, L is lowest
              self.qrCodeImage = filter?.outputImage //getting the filter to output raw image
              //to set the size of qr code
              let length = self.ImageDisplay.frame.size.width
              let height = self.ImageDisplay.frame.size.height
              let transformedImage = self.qrCodeImage.transformed(by: CGAffineTransform(scaleX: length, y: height))
              //
              self.img = UIImage(ciImage: transformedImage)
              print(self.img!)
              if(self.img == nil){
                  print("It is empty")
              }
              else{
                  self.ImageDisplay.image = self.img
              }
          }
      }
  }
  </code></pre>
  
  <p>This code is supposed to take the JSON value and convert it into a QR code which would then be shown through the 'ImageDisplay' image view element. It works when I run it on a simulator, but when I run it on my phone, it doesn't work and always crashes producing the earlier stated error.</p>
  
  <p>It crashes at the point where it has to assign the UIImage to the image view, on the line:</p>
  
  <pre><code>self.ImageDisplay.image = self.img
  </code></pre>