AVFoundation Metadata Object Types

后端 未结 2 437
感情败类
感情败类 2021-01-02 14:24

I\'m trying to use the AVFoundation to read barcodes with the below code, but I keep getting the error below. Help as to why would be much appreciated. Thanks in advance!

相关标签:
2条回答
  • 2021-01-02 14:51

    Try adding both the input and output to the session before setting the metadata object types.

    When you don't have the camera attached to the session yet, availableMetadataObjectTypes will be empty.

    0 讨论(0)
  • 2021-01-02 14:57

    This is one of those rare cases where the error message is very useful.

    Call [output availableMetadataObjectTypes] and make sure what you're trying to set is in there. If not, then don't try to set that value.

    0 讨论(0)
提交回复
热议问题