天蓬老师2017-04-18 09:38:10
Apple Documentation:
"This method may be called frequently, your implementation should be efficient to prevent capture performance problems, including dropped metadata objects."
So the matter of controlling the number of scans needs to be handled by our developers. . .
巴扎黑2017-04-18 09:38:10
I don’t know why the scan function of iPhone5 is different from other models. The camera function of iPhone5 will call this method repeatedly when it is not completely exited- (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection
,
The stringValue scanned out is a URL
NSTextCheckingResult * firstWebUrl = [regex firstMatchInString:stringValue options:0 range:NSMakeRange(0, [stringValue length])];
However, if you call multiple times, null values will be swept out, and stringValue will become null, causing a crash