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!
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.
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.