簡體   English   中英

當我更改iphone的語言時會導致崩潰嗎?

[英]when i changed language of iphone its causing crash?

   let initialStr = "To see information for today, please"

        let tempFontSize = UIUtils.getFontForApproprieteField(.subHeadline).font.pointSize

        let tealDict = [NSAttributedStringKey.font: UIFont.systemFont(ofSize: tempFontSize), NSAttributedStringKey.foregroundColor: UIColor.LTColor()]
        let linkAttributes = [NSAttributedStringKey.foregroundColor: UIColor.LTColor(), NSAttributedStringKey.underlineStyle: NSNumber(value: false as Bool)]
        errorLbl?.linkAttributes = linkAttributes
        errorLbl?.delegate = self

        let attributedString = NSMutableAttributedString(string: AppMessage.emptyWidget, attributes: [NSAttributedStringKey.font: UIFont.systemFont(ofSize: tempFontSize)])
        attributedString.addAttributes(tealDict, range: NSMakeRange(initialStr.length+1,3))
        errorLbl?.attributedText = attributedString

        let rangeT : NSRange = (AppMessage.emptyWidget as NSString).range(of: " add")
        errorLbl?.addLink(to: URL(string: "https://www.google.co.in/")!, with: rangeT)

我要添加“ Add”在后面添加)作為超鏈接。 它適用於所有設備,除非更改語言,否則此行會導致崩潰。

當我更改iphone的語言時,這條線會導致崩潰?

languageChange:-英語->印地語

崩潰:

由於未捕獲的異常“ NSRangeException”而終止應用程序,原因:“ NSMutableRLEArray objectAtIndex:effectiveRange ::越界”

AppMessage.emptyWidget是一個本地化的字符串,但是鍵在localized.string中沒有對應的值,這就是為什么出現范圍問題。 添加了密鑰的值,應用程序運行良好。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM