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)
ich möchte machen hinzufügen, die nach ist bitte als Hyperlink. Es funktioniert in allen Geräten, außer wenn wir die Sprache ändern, die diese Zeile zum Absturz bringt.Wenn ich die Sprache des iPhone geändert habe, verursacht es Absturz?
wenn ich die sprache des iphone diese zeile verursacht crash?
Language: - English -> Hindi
Absturz:
beenden app aufgrund nicht abgefangene Ausnahme 'NSRangeException', Grund: 'NSMutableRLEArray objectAtIndex: effectiveRange :: Out of bounds'
Das bedeutet, dass der Bereich, den Sie übergeben, nicht korrekt ist. Sie müssen es debuggen. –
debuggte. Der nslocalised String-Schlüssel hatte daher keinen entsprechenden Wert. – Amey