![](/img/trans.png)
[英]iOS App UILabel crashed when I change text size from iOS Settings Screen
[英]iOS app crashed when enter text in UiWebView
在我的iOS(Objective C)應用程序中,我正在將UIWebView加載到UIView中,並且當我單擊WebView中的Text字段時會導致App崩潰,例如在Google中說我是否只需觸摸文本字段以輸入一些關鍵字該應用程序將崩潰。 我可以在示例應用程序中打開webView,但是在我的項目中失敗。
我為用戶提供了有關變量的強大參考。 錯誤是:
-[__NSCFSet keyboardWillShow:]: unrecognized selector sent to instance 0x8fa0140
2014-08-25 12:15:40.626 Travelara[1263:60b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFSet keyboardWillShow:]: unrecognized selector sent to instance 0x8fa0140'
*** First throw call stack:
(
0 CoreFoundation 0x01c7a1e4 __exceptionPreprocess + 180
1 libobjc.A.dylib 0x019778e5 objc_exception_throw + 44
2 CoreFoundation 0x01d17243 -[NSObject(NSObject) doesNotRecognizeSelector:] + 275
3 CoreFoundation 0x01c6a50b ___forwarding___ + 1019
4 CoreFoundation 0x01c6a0ee _CF_forwarding_prep_0 + 14
5 Foundation 0x0164a049 __57-[NSNotificationCenter addObserver:selector:name:object:]_block_invoke + 40
6 CoreFoundation 0x01cd5f04 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 20
7 CoreFoundation 0x01c2defb _CFXNotificationPost + 2859
8 Foundation 0x01583e41 -[NSNotificationCenter postNotificationName:object:userInfo:] + 98
9 UIKit 0x00af1625 -[UIInputViewTransition postNotificationsForTransitionStart] + 1004
10 UIKit 0x00ae7562 -[UIPeripheralHost(UIKitInternal) executeTransition:] + 592
11 UIKit 0x00ae9a79 -[UIPeripheralHost(UIKitInternal) setInputViews:animationStyle:] + 929
12 UIKit 0x00ae9e7e -[UIPeripheralHost(UIKitInternal) setInputViews:animated:] + 72
13 UIKit 0x00ae9ec8 -[UIPeripheralHost(UIKitInternal) setInputViews:] + 67
14 UIKit 0x00ae0fb1 -[UIPeripheralHost(UIKitInternal) _reloadInputViewsForResponder:] + 1448
15 UIKit 0x0079d8b4 -[UIResponder(UIResponderInputViewAdditions) reloadInputViews] + 287
16 UIKit 0x00b0a6b5 -[UIWebBrowserView assistFormNode:] + 265
17 UIKit 0x0087e435 __47-[UIWebDocumentView(Interaction) performClick:]_block_invoke172 + 52
18 libdispatch.dylib 0x02e784d0 _dispatch_client_callout + 14
19 libdispatch.dylib 0x02e67439 _dispatch_barrier_sync_f_slow_invoke + 80
20 libdispatch.dylib 0x02e784d0 _dispatch_client_callout + 14
21 libdispatch.dylib 0x02e66726 _dispatch_main_queue_callback_4CF + 340
22 CoreFoundation 0x01cdf43e __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 14
23 CoreFoundation 0x01c205cb __CFRunLoopRun + 1963
24 CoreFoundation 0x01c1f9d3 CFRunLoopRunSpecific + 467
25 CoreFoundation 0x01c1f7eb CFRunLoopRunInMode + 123
26 GraphicsServices 0x034145ee GSEventRunModal + 192
27 GraphicsServices 0x0341442b GSEventRun + 104
28 UIKit 0x00637f9b UIApplicationMain + 1225
29 Travelara 0x0007b34d main + 141
30 libdyld.dylib 0x030ad701 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我使用的代碼是:self.webview1 = [[UIWebView alloc] initWithFrame:CGRectMake(10,70,292,430)];
self.webview1.backgroundColor= [UIColor whiteColor];
self.webview1.userInteractionEnabled=true;
self.webview1.multipleTouchEnabled=true;
self.webview1.delegate=self;
[self addSubview:self.webview1];
self.url=@"https://www.google.co.in/";
self.nsurl=[NSURL URLWithString:self.url];
self.nsrequest=[NSURLRequest requestWithURL:self.nsurl];
[self.webview1 loadRequest:self.nsrequest];
請幫我解決問題。
盡管源代碼不足以做出准確的猜測,但看起來像您定義了以下內容
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification object:nil];
獲取有關鍵盤顯示的事件事件通知,但忘記定義功能
- (void)keyboardWillShow:(NSNotification *)aNotification {
[self performSelector:@selector(readjustWebviewScroller) withObject:nil afterDelay:0];
}
請檢查。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.