搜尋

首頁  >  問答  >  主體

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

大家讲道理大家讲道理2894 天前695

全部回覆(2)我來回復

  • 天蓬老师

    天蓬老师2017-04-18 09:38:10

    蘋果文件:

    "this method may be called frequently, your implementation should be efficient to prevent capture performance problems, including dropped metadata objects."

    所以控制掃描次數的事兒需要咱們開發者處理了。 。 。

    回覆
    0
  • 巴扎黑

    巴扎黑2017-04-18 09:38:10

    不知道為什麼iphone5 的掃一掃功能與其他機型不太一樣, iphone5的相機功能在沒有完全退出的時候 會重複調用這個方法
    - (void)captureOutput:(AVCaptureOutput *)captureOutput didOutputMetadataObjects:(NSArray *)metadataObjects fromConnection:(AVCaptureConnection *)connection,

    掃出來的 stringValue 是一個網址

    1

    <code>NSTextCheckingResult * firstWebUrl = [regex firstMatchInString:stringValue options:0 range:NSMakeRange(0, [stringValue length])];</code>

    但是多次呼叫問題會出現掃出空值,stringValue會變成空值,導致崩潰

    回覆
    0
  • 取消回覆