簡體   English   中英

輸入撇號(')時,UITextField使應用程序崩潰

[英]UITextField crashes app when entering apostrophe (')

當我在文本字段中輸入'(撇號)時,我的應用程序崩潰了。 任何人都可以告訴問題的解決方案。 下面是它崩潰的地方

hotelTextfield.text =  [hotelList objectAtIndex:indexPath.row];

我在文本字段中輸入了其他字符串,但這些字符串沒有引起任何問題。 但是每當我輸入一些',它就會崩潰。 請找到崩潰的堆棧回溯

Program received signal:  “EXC_BAD_ACCESS”.
(gdb) bt
#0  0x31ec3ebc in objc_msgSend ()
#1  0x31ec5b3c in objc_setProperty ()
#2  0x0000e720 in -[AvailabilityVC setHotelList:] (self=0x11fbe0, _cmd=0x1f700, _value=0x31ec3f28) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/Classes/AvailabilityVC.m:29
#3  0x0000c6c8 in -[AvailabilityVC textFieldDidChange:] (self=0x11fbe0, _cmd=0x1f8e7, aNotification=0x1858a0) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/Classes/AvailabilityVC.m:248
#4  0x308ff5d8 in _nsnote_callback ()
#5  0x30de3510 in _CFXNotificationPostNotification ()
#6  0x308fd1b2 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#7  0x308ff518 in -[NSNotificationCenter postNotificationName:object:] ()
#8  0x336b27f4 in -[UITextField fieldEditorDidChange:] ()
#9  0x335eecb4 in -[UIFieldEditor webViewDidChange:] ()
#10 0x308ff5d8 in _nsnote_callback ()
#11 0x30de3510 in _CFXNotificationPostNotification ()
#12 0x308fd1b2 in -[NSNotificationCenter postNotificationName:object:userInfo:] ()
#13 0x30da38e4 in __invoking___ ()
#14 0x30df757a in -[NSInvocation invoke] ()
#15 0x311ca134 in SendDelegateMessage ()
#16 0x3069cb30 in WebEditorClient::respondToChangedContents ()
#17 0x3123c01c in WebCore::Editor::respondToChangedContents ()
#18 0x3123a914 in WebCore::Editor::appliedEditing ()
#19 0x3123a740 in WebCore::TypingCommand::typingAddedToOpenCommand ()
#20 0x3122aa10 in WebCore::TypingCommand::insertTextRunWithoutNewlines ()
#21 0x3122a954 in WebCore::TypingCommand::insertText ()
#22 0x3122947c in WebCore::TypingCommand::insertText ()
#23 0x31228bd4 in WebCore::Editor::insertTextWithoutSendingTextEvent ()
#24 0x31228818 in WebCore::EventHandler::defaultTextInputEventHandler ()
#25 0x311f776c in WebCore::EventTargetNode::defaultEventHandler ()
#26 0x311f7358 in WebCore::EventTargetNode::dispatchGenericEvent ()
#27 0x311f6cf8 in WebCore::EventTargetNode::dispatchEvent ()
#28 0x312284fc in WebCore::EventHandler::handleTextInputEvent ()
#29 0x312283e0 in WebCore::Editor::insertText ()
#30 0x3069bab8 in -[WebHTMLView(WebNSTextInputSupport) insertText:] ()
#31 0x30defa14 in -[NSObject performSelector:withObject:] ()
#32 0x31228280 in -[WAKResponder tryToPerform:with:] ()
#33 0x3069b3d0 in -[WebView(WebViewEditingActions) _performResponderOperation:with:] ()
#34 0x3069b350 in -[WebView(WebViewEditingActions) insertText:] ()
#35 0x3368dd2c in -[UIWebDocumentView insertText:] ()
#36 0x3368d7b0 in -[UIKeyboardImpl addInputString:fromVariantKey:] ()
#37 0x3368ca88 in -[UIKeyboardImpl handleStringInput:fromVariantKey:] ()
#38 0x3368c81c in -[UIKeyboardLayoutStar sendStringAction:forKey:] ()
#39 0x3368b8f0 in -[UIKeyboardLayoutStar touchUp:withPathInfo:] ()
#40 0x3368732c in -[UIKeyboardLayout handleHandEvent:] ()
#41 0x3368b414 in -[UIKeyboardLayout touchesEnded:withEvent:] ()
#42 0x33604900 in -[UIWindow _sendTouchesForEvent:] ()
#43 0x33603f94 in -[UIWindow sendEvent:] ()
#44 0x335ff790 in -[UIApplication sendEvent:] ()
#45 0x335ff094 in _UIApplicationHandleEvent ()
#46 0x332e8990 in PurpleEventCallback ()
#47 0x30de952a in CFRunLoopRunSpecific ()
#48 0x30de8c1e in CFRunLoopRunInMode ()
#49 0x332e7374 in GSEventRunModal ()
#50 0x335adc30 in -[UIApplication _run] ()
#51 0x335ac230 in UIApplicationMain ()
#52 0x00002550 in main (argc=1, argv=0x2ffff540) at /Users/amitkumar_gupta/Documents/Projects/5StarHotels/main.m:13
(gdb) 

好,問題解決了。 這是由於SQLite。 Sqlite無法處理撇號(')。 通過在發送到SQLite之前添加一個額外的'來解決它。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM