Closed NachoSoto closed 10 years ago
This is an iOS 7 only feature - I still want this lib to support older OS's at least until 8 comes out. If you add the necessary checks for backwards-compatability I'll merge this in.
My bad :) I didn't realize NSLinkAttributeName
is only available since iOS 7.0. I just pushed the fix.
I'm embarrassed :P I should have though of this. I'm way too used to not having to worry about it and work iOS 7 only. Fix incoming!
This should do it? I also made it support OS X :)
That should be it.
Actually, by doing this in my own project I realized this can crash if a the parser finds an URL that later fails to be encoded into a NSURL
(I think it was some string of the form a.b
. Note the missing scheme.).
I checked if link.url
is not nil
before adding the attribute, but instead you might want to check here?
Let me know which one you think is better I can add it in :)
Thanks!
Looks good! Merging nao.
Will look at the crash later!
Thanks!
I don't know if there was a reason to not make this the default behavior, so I figured I could add this as a separate method.
I was confused at first thinking the problem was that I wasn't displaying the links on the attributed string correctly due to some bug in UITextView in iOS 7, so hopefully this will help other people too :)