MLKitBarcodeScanning 架構參考資料
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
BarcodeScanner
class BarcodeScanner : NSObject
一種條碼掃描器,可掃描圖片中的條碼。
-
聲明
Swift
class func barcodeScanner(options: MLKBarcodeScannerOptions) -> Self
-
聲明
Swift
class func barcodeScanner() -> Self
-
-
參數
image
|
|
completion
|
掃描條碼或發生錯誤時,用於在主要佇列上回呼的處理常式。
|
-
傳回條碼會在指定圖片中產生結果;如果發生錯誤,則傳回 nil
。條碼掃描
會在呼叫執行緒上同步執行。
建議您從主執行緒呼叫這個方法,以免封鎖 UI。身為
如果在主執行緒上呼叫這個方法,就會產生 NSException
。
參數
image
|
|
error
|
系統在取得結果時發生錯誤時,就會填入選用的錯誤參數。
|
傳回值
條碼陣列會產生指定圖片;如果發生錯誤,則會產生 nil
。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2024-08-22 (世界標準時間)。
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["缺少我需要的資訊","missingTheInformationINeed","thumb-down"],["過於複雜/步驟過多","tooComplicatedTooManySteps","thumb-down"],["過時","outOfDate","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["示例/程式碼問題","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2024-08-22 (世界標準時間)。"],[[["`BarcodeScanner` is a class used for scanning barcodes within images."],["It provides methods to create a scanner instance with custom or default options."],["The `process(_:)` method asynchronously scans an image for barcodes and returns the results."],["The `results(in:)` method synchronously scans an image, but it should be called off the main thread to avoid blocking the UI."]]],["The `BarcodeScanner` class scans barcodes within images. It offers two class methods, `barcodeScanner(options:)` and `barcodeScanner()`, to create instances, either with custom or default configuration options. The `process(_:)` method asynchronously scans an image for barcodes, returning an array of `MLKBarcode` objects. The method `results(in:)` synchronously returns barcode results in a given image. Note that attempting to use the main thread when invoking the method `results(in:)` will raise an error.\n"]]