Open sravanr525 opened 5 years ago
@meetdoshi1 Can you post your view controller's code? I don't think any error message will be helpful (at least for me). It's likely that you added the RichEditorView's constraints before sub viewing it to your view controller.
Just i clone this project and i tested i got crash Error Report: -[UIThreadSafeNode canPerformAction:withSender:]: unrecognized selector sent to instance 0x2830c3440 ["0 CoreFoundation 0x00000001a5e309a0 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 1227168", "1 libobjc.A.dylib 0x00000001a5b590a4 objc_exception_throw + 56", "2 CoreFoundation 0x00000001a5d3443c DA838E75-6B30-360E-9661-C4800A7E1BF6 + 193596", "3 CoreFoundation 0x00000001a5e34e08 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 1244680", "4 CoreFoundation 0x00000001a5e36bec _CF_forwarding_prep_0 + 92", "5 UIKitCore 0x00000001a9c6f758 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8525656", "6 UIKitCore 0x00000001a9c75100 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8548608", "7 UIKitCore 0x00000001a9c95a28 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8682024", "8 UIKitCore 0x00000001a9c72864 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8538212", "9 UIKitCore 0x00000001a9c95a28 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8682024", "10 UIKitCore 0x00000001a9c684dc 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8496348", "11 UIKitCore 0x00000001a9c975e0 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8689120", "12 UIKitCore 0x00000001a9c96010 82C949DD-37F6-35F7-B3EF-62BA342F6BF5 + 8683536", "13 Foundation 0x00000001a6219238 0DF2911E-80CB-3289-8A1E-ED0913D55A12 + 1278520", "14 CoreFoundation 0x00000001a5dae7e0 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 694240", "15 CoreFoundation 0x00000001a5dae738 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 694072", "16 CoreFoundation 0x00000001a5dadf20 DA838E75-6B30-360E-9661-C4800A7E1BF6 + 692000", "17 CoreFoundation 0x00000001a5da901c DA838E75-6B30-360E-9661-C4800A7E1BF6 + 671772", "18 CoreFoundation 0x00000001a5da88bc CFRunLoopRunSpecific + 464", "19 GraphicsServices 0x00000001afc14328 GSEventRunModal + 104", "20 UIKitCore 0x00000001a9e3e6d4 UIApplicationMain + 1936", "21 Tully Dev 0x0000000104cb171c main + 96", "22 libdyld.dylib 0x00000001a5c33460 E1637502-BFCB-3BBC-B3E1-CCF78617E0E4 + 5216"]
Can you post the code from your view controller? It should look something like this:
class BlahVC: UIViewController {
// Stuff should be here.
}
If you don't know what that means, maybe just post the entire project into a repo and we can take a look.
import UIKit import RichEditorView class ViewController: UIViewController,RichEditorDelegate,RichEditorToolbarDelegate{
@IBOutlet var editorView: RichEditorView!
@IBOutlet var htmlTextView: UITextView!
lazy var toolbar: RichEditorToolbar = {
let toolbar = RichEditorToolbar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 44))
toolbar.options = RichEditorDefaultOption.all
return toolbar
}()
fileprivate func randomColor() -> UIColor {
let colors: [UIColor] = [
.red,
.orange,
.yellow,
.green,
.blue,
.purple
]
let color = colors[Int(arc4random_uniform(UInt32(colors.count)))]
return color
}
override func viewDidLoad() {
super.viewDidLoad()
editorView.delegate = self
editorView.inputAccessoryView = toolbar
editorView.placeholder = "Type some text..."
toolbar.delegate = self
toolbar.editor = editorView
editorView.html = "<u>Hshhshshegehgegsggsgsgsg</u> <b>show </b><div><b>Ddd</b></div><div><b style=\"caret-color: rgb(0, 0, 0); -webkit-tap-highlight-color: rgba(26, 26, 26, 0.301961); -webkit-text-size-adjust: 100%; background-color: rgba(255, 255, 255, 0);\"><font color=\"#000000\" face=\"sans-serif\" size=\"3\">show</font></b><b><br></b></div> <h1>hello</h1>\n<script>alert(\"bugged\");</script>\n <h1>hello</h1>\n<script>alert(\"bugged\");</script>\n"
//"<b><font size=\"6\">Jjjjjjjjjjjjf fvdfvjfdbvvfdjb vdfjvbdvdfjvbdvdf vfdvjdfbvdfvkfdjvbdfbkvbdfvkdf dfjkg DVD’s fvdf vodka. Vfdvfd</font><button type=button>Click Me!</button>"
// We will create a custom action that clears all the input text when it is pressed
let item = RichEditorOptionItem(image: nil, title: "Clear") { toolbar in
toolbar.editor?.html = ""
}
var options = toolbar.options
options.append(item)
toolbar.options = options
}
func richEditor(_ editor: RichEditorView, contentDidChange content: String) {
if content.isEmpty {
htmlTextView.text = "HTML Preview"
} else {
htmlTextView.text = content
}
}
func richEditorToolbarChangeTextColor(_ toolbar: RichEditorToolbar) {
let color = randomColor()
toolbar.editor?.setTextColor(color)
}
func richEditorToolbarChangeBackgroundColor(_ toolbar: RichEditorToolbar) {
let color = randomColor()
toolbar.editor?.setTextBackgroundColor(color)
}
func richEditorToolbarInsertImage(_ toolbar: RichEditorToolbar) {
toolbar.editor?.insertImage("https://gravatar.com/avatar/696cf5da599733261059de06c4d1fe22", alt: "Gravatar")
}
func richEditorToolbarInsertLink(_ toolbar: RichEditorToolbar) {
// Can only add links to selected text, so make sure there is a range selection first
if toolbar.editor?.hasRangeSelection == true {
toolbar.editor?.insertLink("http://github.com/cjwirth/RichEditorView", title: "Github Link")
}
}
}
Make sure you copy all the files from the sample correctly, including the .h and .m files.
-[UIThreadSafeNode _axResetFKAFocusToFirstResponder]: unrecognized selector sent to instance 0x600000035ce0
Xcode 11.2.1, iOS 13
same issue
I took a look at the sample. Seems like your view controller is inheriting two delegates. I'm new to Swift, so I'm weary of multiple inheritance. In my opinion, when you're setting the editor's delegate to self, it might be because you have two delegates.
Try making a class extension for the toolbar delegate like the sample shows.
extension ViewController: RichEditorToolbarDelegate {}
Then, the editor's delegate will be assigned to the RichEditorDelegate only. Hope that helps @HarshalValanda and @meetdoshi1
Hi am also facing this issue while trying to backspace,Please help to resolve this issue
When i enter text continuously, at one point app crashed.I think It's exception because i did n't get crash on particular line Crash showing in AppDelegate class. Crashing in iPhone not simulator. If anyone got answer please help me.