Thursday, 19 September 2013

iOS-App crashes on touch of iputbox

iOS-App crashes on touch of iputbox

I am using custom keyboard for webview by hiding the default keyboard. But
my code is crashing whenever I tap on inputbox. It says
-[UITextInteractionAssistant containerIsTextField]: message sent to
deallocated
After a lot of debugging I found out that [self.view endEditing:YES]; is
reposnsible for UITextInteractionAssistant.
Can anyone help in this?
Help in advance!!!



// register for keyboard show event
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(keyboardWillShow:)
name:UIKeyboardWillShowNotification
object:nil];
hiding UIWebviewAccessary
-(void)keyboardWillShow:(NSNotification *)note {
[self.view endEditing:YES];
[self removeBar];
[self performSelector:@selector(adjustFrame) withObject:nil
afterDelay:0.03];
}
- (void)adjustFrame {
[self.webView
stringByEvaluatingJavaScriptFromString:@"window.scroll(0,0)"];
}
- (void)removeBar {
// Locate non-UIWindow.
UIWindow *keyboardWindow = nil;
for (UIWindow *testWindow in [[UIApplication sharedApplication]
windows]) {
if (![[testWindow class] isEqual:[UIWindow class]]) {
keyboardWindow = testWindow;
break;
}
}
// Locate UIWebFormView.
for (UIView *possibleFormView in [keyboardWindow subviews]) {
// iOS 5 sticks the UIWebFormView inside a UIPeripheralHostView.
if ([[possibleFormView description]
rangeOfString:@"UIPeripheralHostView"].location != NSNotFound) {
for (UIView *subviewWhichIsPossibleFormView in
[possibleFormView subviews]) {
if ([[subviewWhichIsPossibleFormView description]
rangeOfString:@"UIWebFormAccessory"].location !=
NSNotFound) {
[subviewWhichIsPossibleFormView removeFromSuperview];
}
}
}
}
}

No comments:

Post a Comment