gpt4 book ai didi

ios - Func 不会停止运行

转载 作者:行者123 更新时间:2023-11-30 12:18:34 26 4
gpt4 key购买 nike

我有以下代码,其中 captureOutput 函数不会停止运行。因此,prepare(for segue) 函数也不会被执行。

这是我的控制台输出:

2017-07-14 13:15:50.142147 [9101:1993811] [MC] Reading from public effective user settings. 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 fatal error: Index out of range (lldb)

最佳答案

您需要手动停止运行之前建立的捕获 session 。示例代码如下所示 -

if metadataObj.stringValue != nil {

print(objMetadataMachineReadableCodeObject.stringValue)
captureSession?.stopRunning()
scannedCode= metadataObj.stringValue

// call the below line in the main thread once your background process is done above
self.performSegue(withIdentifier: "Seguename", sender: self)

}

一旦您在任何 if 语句中获得了条形码扫描的结果并且您确定扫描已完成,您将必须停止捕获 session 。我假设您的metadatobj具有非零字符串值,然后停止示例中的capturesession。

关于ios - Func 不会停止运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45099261/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com