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
になります。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[[["わかりやすい","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"]],["最終更新日 2025-07-25 UTC。"],[[["\u003cp\u003e\u003ccode\u003eBarcodeScanner\u003c/code\u003e is a class used for scanning barcodes within images.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to create a scanner instance with custom or default options.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eprocess(_:)\u003c/code\u003e method asynchronously scans an image for barcodes and returns the results.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eresults(in:)\u003c/code\u003e method synchronously scans an image, but it should be called off the main thread to avoid blocking the UI.\u003c/p\u003e\n"]]],["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"],null,[]]