采用 UIWebView 實(shí)現(xiàn) hybrid 方案過程中予借,遇到過一些 crash越平,剛開始遇到的時(shí)候感覺特別詭異,這里整理一下灵迫,方便今后查閱秦叛。
unrecognized selector
Application Specific Information:
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIWebView paste:]: unrecognized selector sent to instance 0x110f35fc0'
Last Exception Backtrace:
0 CoreFoundation ___exceptionPreprocess
1 libobjc.A.dylib _objc_exception_throw
2 CoreFoundation ___methodDescriptionForSelector
3 CoreFoundation ____forwarding___
4 CoreFoundation __CF_forwarding_prep_0
5 UIKit -[UICalloutBar buttonPressed:]
6 UIKit -[UICalloutBarButton fadeAndSendAction]
7 Foundation ___NSFireDelayedPerform
8 CoreFoundation ___CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
9 CoreFoundation ___CFRunLoopDoTimer
10 CoreFoundation ___CFRunLoopDoTimers
11 CoreFoundation ___CFRunLoopRun
12 CoreFoundation _CFRunLoopRunSpecific
13 GraphicsServices _GSEventRunModal
14 UIKit _UIApplicationMain
15 OneTravel main main.m:14
16 libdyld.dylib _start
發(fā)現(xiàn)這個(gè) crash 的時(shí)候,簡直丈二和尚——摸不著頭腦瀑粥,整個(gè)項(xiàng)目壓根就沒有調(diào)用過這以為方法啊书闸,抓狂了一會(huì)兒,立馬想到了 Stack Overflow利凑。于是找到了這個(gè):
原來如此,Apple 的坑嫌术,按照 ac 的 Answer 方案進(jìn)行修復(fù)即可~今后再遇到如下 UIWebView 的 unrecognized selector哀澈,就知道如何處理了:
"cut:", "copy:", "paste:","select:", "selectAll:", "delete:", "makeTextWritingDirectionLeftToRight:", "makeTextWritingDirectionRightToLeft:", "toggleBoldface:", "toggleItalics:", "toggleUnderline:", "increaseSize:", "decreaseSize:"