Swift : No Matter what I do CIDetector is always nil

前端 未结 4 1676
清歌不尽
清歌不尽 2021-01-03 16:52

i don\'t understand why this code doesn\'t work, the detector is always nil with the CIDetectorTypeQRCode constant, everything work with CIDetectorTypeFace. I Supect a bug f

4条回答
  •  有刺的猬
    2021-01-03 17:20

    The code you provided can't have a nil detector because it's not an optional and the compiler would complain about several places in your code if it was.

    If features is empty then you know it didn't find a QR code in your image. Try providing a better image or turning down the CIDetectorAccuracy.

    If features isn't empty then your cast is failing.

    Edit: You can't pass a nil context in the constructor.

提交回复
热议问题