Reputation: 2699
I have a UIWebview which the user can edit (iOS 6 and above). The webView has userInteractionEnabled YES, and the HTML has contenteditable TRUE, as follows:
- (void)configureView // called from viewDidLoad and setDetailItem:
{
NSString *htmlString = @""
"<html>"
"<body>"
"<div contenteditable=\"true\">"
"1: Click on this line (keyboard appears)<p>"
"<textarea>2: Clicking in this textarea causes crash</textarea><p>"
"</div>"
"</body>"
"</html>";
[myWebView loadHTMLString:htmlString baseURL:nil];
myWebView.userInteractionEnabled = YES;
}
Clicking in the line of text brings up the keyboard. Then, clicking in the textarea causes a crash somewhere in Apple's code:
-[UITextInteractionAssistant(UITextInteractionAssistant_Internal) oneFingerTap:] + 2204
and this console output (courtesy of NSZombieEnabled):
*** -[UITextSelection caretRect]: message sent to deallocated instance 0x746ae90
What am I doing wrong?
(Other info: I'm loading the UIWebView in a brand new Universal project using storyboard and ARC. The crash happens on the iPhone/iPad Simulator and my iPhone 3GS 6.1.3.)
Upvotes: 1
Views: 961
Reputation: 1
i was facing same problem of "UIWebview contenteditable crash in
UITextSelection caretRect". and i got solution.
Solution:-Textarea has bydefault property of contenteditable=true so we don't need to add in please add below code
example:-
"<div contenteditable=\"true\">"
"1: Click on this line (keyboard appears)<p>""</div>"
<div> "<textarea>2: Clicking in this textarea causes crash</textarea><p>"</div>
It is working for me :-)
Upvotes: 0
Reputation: 2699
Looks like an Apple bug -- I field a bug report and they said it was a duplicate. Here's a workaround: put the straight HTML text(s) and the textarea(s) inside separate div tags.
Upvotes: 1