Qui è una questione di divertimento che sto funzionando in dopo l'aggiornamento a Swift 2.0Initializer per legame condizionale deve avere tipo opzionale, non e 'String'
L'errore è sulla url = linea, se lasciate URL.absoluteString
func myFormatCompanyMessageText(attributedString: NSMutableAttributedString) -> NSMutableAttributedString
{
// Define text font
attributedString.addAttribute(NSFontAttributeName, value: UIFont(name: "Montserrat-Light", size: 17)!, range: NSMakeRange(0, attributedString.length))
return attributedString
}
func textView(textView: UITextView, shouldInteractWithURL URL: NSURL, inRange characterRange: NSRange) -> Bool {
if let url = URL.absoluteString {
if #available(iOS 8.0, *) {
VPMainViewController.showCompanyMessageWebView(url)
}
}
return false
}
Hai cercato la documentazione per il metodo 'absoluteString'? Restituisce un optional ?? –
Ho appena controllato. No, non restituisce un optional, ma 'relativeString' è – mosaic6