search

Home  >  Q&A  >  body text

ios - iPhone 5 真机下 使用扫一扫功能 扫描二维码,用苹果自带正则表达式却崩溃了

大家讲道理大家讲道理2771 days ago658

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师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. . .

    reply
    0
  • 巴扎黑

    巴扎黑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

    reply
    0
  • Cancelreply