iOS 6 UITextView Link Detection Issue

2019-09-15 04:03发布

问题:

I am coming across a strange bug in my app, that I believe is an iOS 6 bug.

I have a UITextView that contains some text that has some links and phone numbers. In my storyboard, I have Links & Phone Numbers checked under 'Detection' for my UITextView. In code I also do:

_txtvFooter.editable = NO;
_txtvFooter.dataDetectorTypes = UIDataDetectorTypeAll;

The issue I am having is a strange one, but when I run my app onto my device (or sim) from Xcode, the UITextView detects all of the links fine, and I can click them. If I then run the app not in debug (not running through Xcode), the links show as black standard text and cannot be touched. Note this is only happening on iOS 6.

On the iOS 5 simulator, the links show as blue and are clickable no matter if the app is run in debug, or just ran from the simulator.

I have looked all over the internets, and cannot find a solution or anyone else who has reported this issue. Does anyone know if something changed in iOS 6 specifically? I thing is, like I said it detects the links when run straight from Xcode, so to me it seems like an iOS 6 bug.

Any help is appreciated!

回答1:

I found what was causing my issue. What I was doing was placing a UIView in the footer of a UITableView in Storyboard that contained a UITextView.

The fix was dumb... I removed the UITextView from the UIView and just used that as the footer (I at one point had multiple textviews in the footer) and the links began detecting.

I still believe this is a bug though-- because if you do need to use a UIView the links would not detect from the textviews within.