UITextView textViewShouldBeginEditing crashes when tapped more than once












4















I have a UIViewController. In this controller I programmatically create a UITextView and set its delegate as my controller. I do this because I dont want to start editing the textView when I tap it.



ViewDidLoad method



UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(9, 10, 302, 200)];
[textView setDelegate:self];
[self.view addSubview:textView];
[textView release];


I implemented the textViewShouldBeginEditing method to return NO here to disable the keyboard from showing up.



textViewShouldBeginEditing method



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
NSLog(@"Shouldbegin");
return NO;
}


The problem that appears



When I tap the textView it works once, but if i tap it again it will crash the application without any log. The weird thing when I hold the textView and release it, it will work like I want it to work. A normal single tap on the other hand doesn't work a second time.



Edit



Single tapping quickly after each other also seems to work, so it seems that it wont work after i wait x seconds.



After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should. The error log on a iOS 5.1 device says the following:



Date/Time:       2012-04-17 14:00:49.497 +0200
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000014
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInput 0x36bf69e8 TI::Favonius::BeamSearch::choose_hit_test_node(WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::KeyAreaNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&) + 12
1 TextInput 0x36bf6d1e TI::Favonius::BeamSearch::update_for_touch(unsigned int, WTF::PassRefPtr<TI::Favonius::KeyAreaNode>) + 602
2 TextInput 0x36bfb5c2 TI::Favonius::StrokeBuildManager::update_search_for_touch(unsigned int, int) + 66
3 TextInput 0x36bfb97c TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI(bool, CGPoint, double, int, int, float, bool, ZT::LayoutDictionaryContext&, bool, int) + 216
4 TextInput 0x36bddf54 TIInputManagerZephyr::simulate_touches_for_input_string() + 344
5 TextInput 0x36bed8ba -[TIKeyboardInputManagerZephyr candidates] + 214
6 UIKit 0x31066616 -[UIKeyboardImpl generateAutocorrectionReplacements:] + 82
7 UIKit 0x31108a96 __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 + 370
8 UIKit 0x3110ec62 -[UITextSelectionView calculateAndShowReplacements:] + 6
9 Foundation 0x3762192c __NSFireDelayedPerform + 408
10 CoreFoundation 0x361a1a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
11 CoreFoundation 0x361a1692 __CFRunLoopDoTimer + 358
12 CoreFoundation 0x361a0268 __CFRunLoopRun + 1200
13 CoreFoundation 0x3612349e CFRunLoopRunSpecific + 294
14 CoreFoundation 0x36123366 CFRunLoopRunInMode + 98
15 GraphicsServices 0x324e3432 GSEventRunModal + 130
16 UIKit 0x30e70e76 UIApplicationMain + 1074









share|improve this question

























  • remove [textView release]; from your ViewDidLoad method and then try it.

    – Nikhil Bansal
    Apr 17 '12 at 10:18











  • Does not work :)

    – Wesley
    Apr 17 '12 at 10:21











  • On my side its working fine.But i'm using ARC Enable.

    – Nikhil Bansal
    Apr 17 '12 at 10:26











  • Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

    – Wesley
    Apr 17 '12 at 10:30
















4















I have a UIViewController. In this controller I programmatically create a UITextView and set its delegate as my controller. I do this because I dont want to start editing the textView when I tap it.



ViewDidLoad method



UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(9, 10, 302, 200)];
[textView setDelegate:self];
[self.view addSubview:textView];
[textView release];


I implemented the textViewShouldBeginEditing method to return NO here to disable the keyboard from showing up.



textViewShouldBeginEditing method



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
NSLog(@"Shouldbegin");
return NO;
}


The problem that appears



When I tap the textView it works once, but if i tap it again it will crash the application without any log. The weird thing when I hold the textView and release it, it will work like I want it to work. A normal single tap on the other hand doesn't work a second time.



Edit



Single tapping quickly after each other also seems to work, so it seems that it wont work after i wait x seconds.



After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should. The error log on a iOS 5.1 device says the following:



Date/Time:       2012-04-17 14:00:49.497 +0200
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000014
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInput 0x36bf69e8 TI::Favonius::BeamSearch::choose_hit_test_node(WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::KeyAreaNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&) + 12
1 TextInput 0x36bf6d1e TI::Favonius::BeamSearch::update_for_touch(unsigned int, WTF::PassRefPtr<TI::Favonius::KeyAreaNode>) + 602
2 TextInput 0x36bfb5c2 TI::Favonius::StrokeBuildManager::update_search_for_touch(unsigned int, int) + 66
3 TextInput 0x36bfb97c TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI(bool, CGPoint, double, int, int, float, bool, ZT::LayoutDictionaryContext&, bool, int) + 216
4 TextInput 0x36bddf54 TIInputManagerZephyr::simulate_touches_for_input_string() + 344
5 TextInput 0x36bed8ba -[TIKeyboardInputManagerZephyr candidates] + 214
6 UIKit 0x31066616 -[UIKeyboardImpl generateAutocorrectionReplacements:] + 82
7 UIKit 0x31108a96 __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 + 370
8 UIKit 0x3110ec62 -[UITextSelectionView calculateAndShowReplacements:] + 6
9 Foundation 0x3762192c __NSFireDelayedPerform + 408
10 CoreFoundation 0x361a1a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
11 CoreFoundation 0x361a1692 __CFRunLoopDoTimer + 358
12 CoreFoundation 0x361a0268 __CFRunLoopRun + 1200
13 CoreFoundation 0x3612349e CFRunLoopRunSpecific + 294
14 CoreFoundation 0x36123366 CFRunLoopRunInMode + 98
15 GraphicsServices 0x324e3432 GSEventRunModal + 130
16 UIKit 0x30e70e76 UIApplicationMain + 1074









share|improve this question

























  • remove [textView release]; from your ViewDidLoad method and then try it.

    – Nikhil Bansal
    Apr 17 '12 at 10:18











  • Does not work :)

    – Wesley
    Apr 17 '12 at 10:21











  • On my side its working fine.But i'm using ARC Enable.

    – Nikhil Bansal
    Apr 17 '12 at 10:26











  • Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

    – Wesley
    Apr 17 '12 at 10:30














4












4








4


2






I have a UIViewController. In this controller I programmatically create a UITextView and set its delegate as my controller. I do this because I dont want to start editing the textView when I tap it.



ViewDidLoad method



UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(9, 10, 302, 200)];
[textView setDelegate:self];
[self.view addSubview:textView];
[textView release];


I implemented the textViewShouldBeginEditing method to return NO here to disable the keyboard from showing up.



textViewShouldBeginEditing method



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
NSLog(@"Shouldbegin");
return NO;
}


The problem that appears



When I tap the textView it works once, but if i tap it again it will crash the application without any log. The weird thing when I hold the textView and release it, it will work like I want it to work. A normal single tap on the other hand doesn't work a second time.



Edit



Single tapping quickly after each other also seems to work, so it seems that it wont work after i wait x seconds.



After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should. The error log on a iOS 5.1 device says the following:



Date/Time:       2012-04-17 14:00:49.497 +0200
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000014
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInput 0x36bf69e8 TI::Favonius::BeamSearch::choose_hit_test_node(WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::KeyAreaNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&) + 12
1 TextInput 0x36bf6d1e TI::Favonius::BeamSearch::update_for_touch(unsigned int, WTF::PassRefPtr<TI::Favonius::KeyAreaNode>) + 602
2 TextInput 0x36bfb5c2 TI::Favonius::StrokeBuildManager::update_search_for_touch(unsigned int, int) + 66
3 TextInput 0x36bfb97c TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI(bool, CGPoint, double, int, int, float, bool, ZT::LayoutDictionaryContext&, bool, int) + 216
4 TextInput 0x36bddf54 TIInputManagerZephyr::simulate_touches_for_input_string() + 344
5 TextInput 0x36bed8ba -[TIKeyboardInputManagerZephyr candidates] + 214
6 UIKit 0x31066616 -[UIKeyboardImpl generateAutocorrectionReplacements:] + 82
7 UIKit 0x31108a96 __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 + 370
8 UIKit 0x3110ec62 -[UITextSelectionView calculateAndShowReplacements:] + 6
9 Foundation 0x3762192c __NSFireDelayedPerform + 408
10 CoreFoundation 0x361a1a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
11 CoreFoundation 0x361a1692 __CFRunLoopDoTimer + 358
12 CoreFoundation 0x361a0268 __CFRunLoopRun + 1200
13 CoreFoundation 0x3612349e CFRunLoopRunSpecific + 294
14 CoreFoundation 0x36123366 CFRunLoopRunInMode + 98
15 GraphicsServices 0x324e3432 GSEventRunModal + 130
16 UIKit 0x30e70e76 UIApplicationMain + 1074









share|improve this question
















I have a UIViewController. In this controller I programmatically create a UITextView and set its delegate as my controller. I do this because I dont want to start editing the textView when I tap it.



ViewDidLoad method



UITextView* textView = [[UITextView alloc] initWithFrame:CGRectMake(9, 10, 302, 200)];
[textView setDelegate:self];
[self.view addSubview:textView];
[textView release];


I implemented the textViewShouldBeginEditing method to return NO here to disable the keyboard from showing up.



textViewShouldBeginEditing method



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
NSLog(@"Shouldbegin");
return NO;
}


The problem that appears



When I tap the textView it works once, but if i tap it again it will crash the application without any log. The weird thing when I hold the textView and release it, it will work like I want it to work. A normal single tap on the other hand doesn't work a second time.



Edit



Single tapping quickly after each other also seems to work, so it seems that it wont work after i wait x seconds.



After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should. The error log on a iOS 5.1 device says the following:



Date/Time:       2012-04-17 14:00:49.497 +0200
OS Version: iPhone OS 5.1 (9B176)
Report Version: 104

Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000014
Crashed Thread: 0

Thread 0 name: Dispatch queue: com.apple.main-thread
Thread 0 Crashed:
0 TextInput 0x36bf69e8 TI::Favonius::BeamSearch::choose_hit_test_node(WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::KeyAreaNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&, WTF::RefPtr<TI::Favonius::SearchNode> const&) + 12
1 TextInput 0x36bf6d1e TI::Favonius::BeamSearch::update_for_touch(unsigned int, WTF::PassRefPtr<TI::Favonius::KeyAreaNode>) + 602
2 TextInput 0x36bfb5c2 TI::Favonius::StrokeBuildManager::update_search_for_touch(unsigned int, int) + 66
3 TextInput 0x36bfb97c TI::Favonius::StrokeBuildManager::key_down_or_drag_hit_test_for_UI(bool, CGPoint, double, int, int, float, bool, ZT::LayoutDictionaryContext&, bool, int) + 216
4 TextInput 0x36bddf54 TIInputManagerZephyr::simulate_touches_for_input_string() + 344
5 TextInput 0x36bed8ba -[TIKeyboardInputManagerZephyr candidates] + 214
6 UIKit 0x31066616 -[UIKeyboardImpl generateAutocorrectionReplacements:] + 82
7 UIKit 0x31108a96 __71-[UITextInteractionAssistant scheduleReplacementsForRange:withOptions:]_block_invoke_0 + 370
8 UIKit 0x3110ec62 -[UITextSelectionView calculateAndShowReplacements:] + 6
9 Foundation 0x3762192c __NSFireDelayedPerform + 408
10 CoreFoundation 0x361a1a2c __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 8
11 CoreFoundation 0x361a1692 __CFRunLoopDoTimer + 358
12 CoreFoundation 0x361a0268 __CFRunLoopRun + 1200
13 CoreFoundation 0x3612349e CFRunLoopRunSpecific + 294
14 CoreFoundation 0x36123366 CFRunLoopRunInMode + 98
15 GraphicsServices 0x324e3432 GSEventRunModal + 130
16 UIKit 0x30e70e76 UIApplicationMain + 1074






iphone objective-c ios xcode uitextview






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 17 '12 at 12:08







Wesley

















asked Apr 17 '12 at 10:12









WesleyWesley

1,8621423




1,8621423













  • remove [textView release]; from your ViewDidLoad method and then try it.

    – Nikhil Bansal
    Apr 17 '12 at 10:18











  • Does not work :)

    – Wesley
    Apr 17 '12 at 10:21











  • On my side its working fine.But i'm using ARC Enable.

    – Nikhil Bansal
    Apr 17 '12 at 10:26











  • Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

    – Wesley
    Apr 17 '12 at 10:30



















  • remove [textView release]; from your ViewDidLoad method and then try it.

    – Nikhil Bansal
    Apr 17 '12 at 10:18











  • Does not work :)

    – Wesley
    Apr 17 '12 at 10:21











  • On my side its working fine.But i'm using ARC Enable.

    – Nikhil Bansal
    Apr 17 '12 at 10:26











  • Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

    – Wesley
    Apr 17 '12 at 10:30

















remove [textView release]; from your ViewDidLoad method and then try it.

– Nikhil Bansal
Apr 17 '12 at 10:18





remove [textView release]; from your ViewDidLoad method and then try it.

– Nikhil Bansal
Apr 17 '12 at 10:18













Does not work :)

– Wesley
Apr 17 '12 at 10:21





Does not work :)

– Wesley
Apr 17 '12 at 10:21













On my side its working fine.But i'm using ARC Enable.

– Nikhil Bansal
Apr 17 '12 at 10:26





On my side its working fine.But i'm using ARC Enable.

– Nikhil Bansal
Apr 17 '12 at 10:26













Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

– Wesley
Apr 17 '12 at 10:30





Well i have ARC disabled. The controller where the textview is presented is pushed onto a navigationstack and there is some other code around it, but it should work if you ask me too... weirdly enough it does only for a small part.

– Wesley
Apr 17 '12 at 10:30












5 Answers
5






active

oldest

votes


















1














I did find a solution. I don't really like working around Apple bugs but sometimes you have to. It is three steps...



1) replace the default keyboard with an invisible view



- (void)viewDidLoad
{
[super viewDidLoad];
myTextView.inputView = customKeyboard;
}


2) answer YES to allow editing



- (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
return YES;
}


3) In textViewDidChangeSelection resign the first responder to hide the cursor



- (void)textViewDidChangeSelection:(UITextView *)textView{
[textView resignFirstResponder];
}





share|improve this answer


























  • Seems like an OK work around :-). I dont remember what I did to fix it eventually.

    – Wesley
    Jun 21 '12 at 9:16











  • I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

    – Syed_Adeel
    Sep 28 '13 at 11:22



















0














If you don't want to start editing of UITextView when you tapped it:



UITextView* textView = ...;
textView.editable = NO;





share|improve this answer
























  • I also want to know if it is getting clicked :)

    – Wesley
    Apr 17 '12 at 11:50











  • Try UITapGestureRecognizer

    – Aliaksandr Andrashuk
    Apr 17 '12 at 13:36



















0














After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should.



Look in my main post where i edited the logfile.






share|improve this answer
























  • If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

    – calampunay
    May 1 '13 at 16:48



















0














-(BOOL)textViewShouldBeginEditing:(UITextView *)textView
{

[txtView resignFirstResponder];

}


and release txtView in dealloc method






share|improve this answer

































    0














    Swift 4.2
    The best and easy way to solve this just make undo manager as false



    textView.undoManager?.disableUndoRegistration()


    This error appears if you have change the view at run time like within the table, and cell will be reloaded on tapping,






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10189239%2fuitextview-textviewshouldbeginediting-crashes-when-tapped-more-than-once%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      5 Answers
      5






      active

      oldest

      votes








      5 Answers
      5






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      1














      I did find a solution. I don't really like working around Apple bugs but sometimes you have to. It is three steps...



      1) replace the default keyboard with an invisible view



      - (void)viewDidLoad
      {
      [super viewDidLoad];
      myTextView.inputView = customKeyboard;
      }


      2) answer YES to allow editing



      - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
      return YES;
      }


      3) In textViewDidChangeSelection resign the first responder to hide the cursor



      - (void)textViewDidChangeSelection:(UITextView *)textView{
      [textView resignFirstResponder];
      }





      share|improve this answer


























      • Seems like an OK work around :-). I dont remember what I did to fix it eventually.

        – Wesley
        Jun 21 '12 at 9:16











      • I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

        – Syed_Adeel
        Sep 28 '13 at 11:22
















      1














      I did find a solution. I don't really like working around Apple bugs but sometimes you have to. It is three steps...



      1) replace the default keyboard with an invisible view



      - (void)viewDidLoad
      {
      [super viewDidLoad];
      myTextView.inputView = customKeyboard;
      }


      2) answer YES to allow editing



      - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
      return YES;
      }


      3) In textViewDidChangeSelection resign the first responder to hide the cursor



      - (void)textViewDidChangeSelection:(UITextView *)textView{
      [textView resignFirstResponder];
      }





      share|improve this answer


























      • Seems like an OK work around :-). I dont remember what I did to fix it eventually.

        – Wesley
        Jun 21 '12 at 9:16











      • I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

        – Syed_Adeel
        Sep 28 '13 at 11:22














      1












      1








      1







      I did find a solution. I don't really like working around Apple bugs but sometimes you have to. It is three steps...



      1) replace the default keyboard with an invisible view



      - (void)viewDidLoad
      {
      [super viewDidLoad];
      myTextView.inputView = customKeyboard;
      }


      2) answer YES to allow editing



      - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
      return YES;
      }


      3) In textViewDidChangeSelection resign the first responder to hide the cursor



      - (void)textViewDidChangeSelection:(UITextView *)textView{
      [textView resignFirstResponder];
      }





      share|improve this answer















      I did find a solution. I don't really like working around Apple bugs but sometimes you have to. It is three steps...



      1) replace the default keyboard with an invisible view



      - (void)viewDidLoad
      {
      [super viewDidLoad];
      myTextView.inputView = customKeyboard;
      }


      2) answer YES to allow editing



      - (BOOL)textViewShouldBeginEditing:(UITextView *)textView{
      return YES;
      }


      3) In textViewDidChangeSelection resign the first responder to hide the cursor



      - (void)textViewDidChangeSelection:(UITextView *)textView{
      [textView resignFirstResponder];
      }






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited May 14 '15 at 11:54









      Salim

      10.9k56276




      10.9k56276










      answered Jun 20 '12 at 20:07









      RW.RW.

      267314




      267314













      • Seems like an OK work around :-). I dont remember what I did to fix it eventually.

        – Wesley
        Jun 21 '12 at 9:16











      • I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

        – Syed_Adeel
        Sep 28 '13 at 11:22



















      • Seems like an OK work around :-). I dont remember what I did to fix it eventually.

        – Wesley
        Jun 21 '12 at 9:16











      • I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

        – Syed_Adeel
        Sep 28 '13 at 11:22

















      Seems like an OK work around :-). I dont remember what I did to fix it eventually.

      – Wesley
      Jun 21 '12 at 9:16





      Seems like an OK work around :-). I dont remember what I did to fix it eventually.

      – Wesley
      Jun 21 '12 at 9:16













      I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

      – Syed_Adeel
      Sep 28 '13 at 11:22





      I cannot change the keyboard type because it has to be the numpad, and the remaining steps are not working for me .

      – Syed_Adeel
      Sep 28 '13 at 11:22













      0














      If you don't want to start editing of UITextView when you tapped it:



      UITextView* textView = ...;
      textView.editable = NO;





      share|improve this answer
























      • I also want to know if it is getting clicked :)

        – Wesley
        Apr 17 '12 at 11:50











      • Try UITapGestureRecognizer

        – Aliaksandr Andrashuk
        Apr 17 '12 at 13:36
















      0














      If you don't want to start editing of UITextView when you tapped it:



      UITextView* textView = ...;
      textView.editable = NO;





      share|improve this answer
























      • I also want to know if it is getting clicked :)

        – Wesley
        Apr 17 '12 at 11:50











      • Try UITapGestureRecognizer

        – Aliaksandr Andrashuk
        Apr 17 '12 at 13:36














      0












      0








      0







      If you don't want to start editing of UITextView when you tapped it:



      UITextView* textView = ...;
      textView.editable = NO;





      share|improve this answer













      If you don't want to start editing of UITextView when you tapped it:



      UITextView* textView = ...;
      textView.editable = NO;






      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 17 '12 at 11:12









      Aliaksandr AndrashukAliaksandr Andrashuk

      93767




      93767













      • I also want to know if it is getting clicked :)

        – Wesley
        Apr 17 '12 at 11:50











      • Try UITapGestureRecognizer

        – Aliaksandr Andrashuk
        Apr 17 '12 at 13:36



















      • I also want to know if it is getting clicked :)

        – Wesley
        Apr 17 '12 at 11:50











      • Try UITapGestureRecognizer

        – Aliaksandr Andrashuk
        Apr 17 '12 at 13:36

















      I also want to know if it is getting clicked :)

      – Wesley
      Apr 17 '12 at 11:50





      I also want to know if it is getting clicked :)

      – Wesley
      Apr 17 '12 at 11:50













      Try UITapGestureRecognizer

      – Aliaksandr Andrashuk
      Apr 17 '12 at 13:36





      Try UITapGestureRecognizer

      – Aliaksandr Andrashuk
      Apr 17 '12 at 13:36











      0














      After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should.



      Look in my main post where i edited the logfile.






      share|improve this answer
























      • If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

        – calampunay
        May 1 '13 at 16:48
















      0














      After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should.



      Look in my main post where i edited the logfile.






      share|improve this answer
























      • If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

        – calampunay
        May 1 '13 at 16:48














      0












      0








      0







      After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should.



      Look in my main post where i edited the logfile.






      share|improve this answer













      After some testing I found out it seems to be an iOS 5.X > bug. When running my App in a 4.3 device/simulator it works like it should.



      Look in my main post where i edited the logfile.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 25 '12 at 12:45









      WesleyWesley

      1,8621423




      1,8621423













      • If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

        – calampunay
        May 1 '13 at 16:48



















      • If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

        – calampunay
        May 1 '13 at 16:48

















      If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

      – calampunay
      May 1 '13 at 16:48





      If you are not using ARC, then you should create a property (retain, nonatomic) for the textView so that it is not released after the viewDidLoad method

      – calampunay
      May 1 '13 at 16:48











      0














      -(BOOL)textViewShouldBeginEditing:(UITextView *)textView
      {

      [txtView resignFirstResponder];

      }


      and release txtView in dealloc method






      share|improve this answer






























        0














        -(BOOL)textViewShouldBeginEditing:(UITextView *)textView
        {

        [txtView resignFirstResponder];

        }


        and release txtView in dealloc method






        share|improve this answer




























          0












          0








          0







          -(BOOL)textViewShouldBeginEditing:(UITextView *)textView
          {

          [txtView resignFirstResponder];

          }


          and release txtView in dealloc method






          share|improve this answer















          -(BOOL)textViewShouldBeginEditing:(UITextView *)textView
          {

          [txtView resignFirstResponder];

          }


          and release txtView in dealloc method







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Sep 5 '12 at 22:32









          Bo Persson

          78.2k17118184




          78.2k17118184










          answered Apr 17 '12 at 11:25









          Rinju JainRinju Jain

          1,5561323




          1,5561323























              0














              Swift 4.2
              The best and easy way to solve this just make undo manager as false



              textView.undoManager?.disableUndoRegistration()


              This error appears if you have change the view at run time like within the table, and cell will be reloaded on tapping,






              share|improve this answer




























                0














                Swift 4.2
                The best and easy way to solve this just make undo manager as false



                textView.undoManager?.disableUndoRegistration()


                This error appears if you have change the view at run time like within the table, and cell will be reloaded on tapping,






                share|improve this answer


























                  0












                  0








                  0







                  Swift 4.2
                  The best and easy way to solve this just make undo manager as false



                  textView.undoManager?.disableUndoRegistration()


                  This error appears if you have change the view at run time like within the table, and cell will be reloaded on tapping,






                  share|improve this answer













                  Swift 4.2
                  The best and easy way to solve this just make undo manager as false



                  textView.undoManager?.disableUndoRegistration()


                  This error appears if you have change the view at run time like within the table, and cell will be reloaded on tapping,







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Nov 27 '18 at 11:00









                  Sazid IqabalSazid Iqabal

                  15814




                  15814






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f10189239%2fuitextview-textviewshouldbeginediting-crashes-when-tapped-more-than-once%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Contact image not getting when fetch all contact list from iPhone by CNContact

                      count number of partitions of a set with n elements into k subsets

                      A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks