Take the 2-minute tour ×

I am getting an interesting warning at build time (iPhone simulator) that gives the following:

EditView.xib:35:0 UITextView does not support data detectors when the text view is editable.

This is basically non existent on google and I would like to remove it.

My editview.xib has a textview where I write notes into it. Is there any more info that is needed?

share|improve this question
so does this problem exist for anyone else, it is otherwise non-existent in google and stackoverflow! –  norskben Jan 20 '10 at 9:18

6 Answers 6

up vote 5 down vote accepted

I was seeing this warning as well. Here's how I fixed it:

In the xib file in Interface Builder, select your text view, and bring up the attributes inspector. Make sure that "Detects Phone numbers" and "Detects Links" are both UNCHECKED.

I had "Detects Links" checked, and turns out that's what was causing the warning. Basically, if the textview is editable, you don't want these auto-detect features turned on.

share|improve this answer
awesome :) nice tip –  norskben Feb 2 '10 at 16:44
"you don't want these auto-detect features turned on." -- but Apple's Notes app does this. Why shouldn't we? –  Max Seelemann Oct 13 '10 at 14:22

I have four different Xibs with similar TextViews that are used for notes as well. I was getting the same warnings. The suggestion to disable the "Detects Phone Numbers" and "Detects Links" does removes the warnings. However, I wanted my users to still have the ability to use the detectors in my notes.

This is how I solved the issue in my app:

  1. In IB: I deselected the two properties for the TextView. -(which does stop the build warnings).

  2. In my - (void)viewDidLoad { I set the properties of the textView to the following: myTextView.dataDetectorTypes = UIDataDetectorTypeAll; which enables the data detectors of all types (phone numbers and url addresses).

  3. In my View Controller's: -(void)textViewDidBeginEditing:(UITextView *)sender { method, I turned the data detectors back OFF using: myTextView.dataDetectorTypes = UIDataDetectorTypeNone

  4. Then taking advantage of the -(void)textViewDidEndEditing:(UITextView *)sender { method, I turned them back ON using: myTextView.dataDetectorTypes = UIDataDetectorTypeAll;

This method disables the data detectors when the user is editing the UITextView and turns the data detectors back ON when the user is finished editing. This Fix allowed for selection of the phone numbers and URL from within the textView, so that I did not loose the function.

I found the following in the Apple Docs on the DataDetectors for UITextView: after playing around with the UITextView for a while, hope it helps.




  • UIDataDetectorTypePhoneNumber;
  • UIDataDetectorTypeLink;
  • UIDataDetectorTypeNone;
  • UIDataDetectorTypeAll;

Update: 11-5-2010;

Extra Note: Data detectors are not permitted if UITextView is "Editable", because there would be too many variables to track users changes to text as well as touches with trying to execute phone call or links.

Solution: Load the TextView with self.textView.editable = NO; and set you UIDataDetector's based on the types I listed above. This way if the user wants to "select" web address or phone number etc, the delegate can handle. When you need your user to edit the textView, then turn ON the self.textView.editing = YES; & remove your UIDataDetectors accordingly. This should assure no errors or warnings during compiling.

Special Consideration: Be sure to first remove the datadectors when re-enabling, then enable "editing = YES;"...The order is important no to enable editing if UIdatadetectors are still assigned.

Therefore, the sequence order should be something like this...

  • To Edit textView: 1. remove data detectors, 2. then enable editing = YES.

  • To Use DataDetectors: 1. Disable Editing = NO; 2. then remove data detectors.

share|improve this answer
Doesn't seem to work any longer. –  Max Seelemann Oct 13 '10 at 14:21
@Max Seelemann: Added 11-5-2010 update information that may help. -Take Care. –  Newbyman Nov 6 '10 at 1:02
But wouldn't the user then have to tap the text view twice to set the cursor accordingly? Or is the insertion point placed correctly? –  Max Seelemann Nov 6 '10 at 14:15
@Max Seelemann: You can utilize a UIButton or other switch to control editing ON/OFF, which in turn can be used to trigger your custom -(IBAction)setupTextViewForEditing and Visversa in reverse. The user would selecting editing mode, make there normal changes, then lock the textView back by exiting "editing" mode. At this point the data types are turned back on and the user's selections produce action to website, phone call, etc... –  Newbyman Nov 18 '10 at 8:14
That's right. But very very faaaaar from elegant. Until there is a seamless solution like it exists in the Notes app, we prefer to opt for no data types. Thank you for your help though! –  Max Seelemann Nov 18 '10 at 11:53

So Wordy！

textView.editable = NO;
textView.dataDetectorTypes = UIDataDetectorTypeAll;

the URL address must start with "http://", otherwise the textview cannot detect it.

share|improve this answer
links with "www." type also detects good, without "http://" prefix. –  Valery Pavlov Sep 9 '11 at 7:26

I thought about trying to use a Tap-Gesture-Recognizer with "delaysTouchesBegan = YES" and "cancelsTouchesInView = NO"

It is still quite easy to solve!

Load view with editable disabled as well as UIDataDetectorTypeAll or the types of links you want to detect. Then add a GestureRecognizer:

UITapGestureRecognizer *recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self
recognizer.delegate = self;
recognizer.numberOfTapsRequired = 1;
[self.textViewNotes addGestureRecognizer:recognizer];

So you can change settings within this method:

- (void) editTextRecognizerTabbed:(UITapGestureRecognizer *) aRecognizer;
    self.textViewNotes.dataDetectorTypes = UIDataDetectorTypeNone;
    self.textViewNotes.editable = YES;
    [self.textViewNotes becomeFirstResponder];

And at least you have to change the edit and detections settings back after user has finished the text input:

- (void)textViewDidEndEditing:(UITextView *)textView;
    self.textViewNotes.editable = YES;
    self.textViewNotes.dataDetectorTypes = UIDataDetectorTypeAll;

works lika a charm!

share|improve this answer
As best I can tell, this is what Notes is doing, with the addition of using the UITapGestureRecognizer's location to place the selection point appropriately –  Mike Abdullah May 21 at 17:05

Data detectors for the UITextView would be for copy and paste. Since you are setting it as editable, copy/paste shouldn't be allowed where you think paste should, but copy shouldn't.

share|improve this answer

Simplenote somehow does this on iOS 4. (There's a free/lite version in case you wanna try.)

It acts a little bit different: When tapping on one of the highlighted parts, it still starts the editing, and won't follow the link.

But when you tap-and-hold on a detected dataTpye, it shows yout the menu for calling, open the link or whatever.

Also, when tapping inside the text the editing really starts at the place you tapped. So they somehow remove the dataDectectors, enable editing AND get the touches forwarded to the editable UITextview AFTER the tap is recognized.

Any ideas how to do that?


So I can remove the dataConnectorTypes and set it editable on the action method of the recognizer, and hopefully the touches to the UITextview are delivered AFTER that.

But haven't had time to test it so far.

share|improve this answer
"I thought about trying to use a Tap-Gesture-Recognizer with "delaysTouchesBegan = YES" and "cancelsTouchesInView = NO"", just tried this and it didn't work. –  cynistersix May 25 '12 at 19:03

Your Answer


