Chinese handwriting input method crash on iOS8.1 - crash

If user is using Chinese handwriting input method. After he typed anything and select candidates my app crashes. This only happens on iOS8.1 and only with the handwriting input method on my app. Other apps will not crash.
The crash log gives the information that:
2014-10-22 14:45:10.269 App[524:170755] -[UIKBBlurredKeyView candidateList]: unrecognized selector sent to instance 0x16ff44b0

Found the reason.
I have overridden touchesBegan method of UIScrollView in a category.

Related

Unrecognized Selector Sent to Instance; selector doesn't exist?

So I'm new to objective c, practically new to programming in general.
Anyway, in my simple program, I control-dragged my UITextField from the storyboard into my ViewController.m thinking it was a way to create a method to be invoked when the field was entered/tapped on. It wasn't long until I deleted the method.
When running the simulator, the keyboard would come up and the text field would already be focused on. If I tapped anywhere else on the screen, it resulted in a crash giving me the unrecognized selector error for the selector I already deleted.
There's nothing in my ViewController.h and the rest of the code seems fine. If I re-add the selector with no instructions, it behaves as intended and the keyboard resigns. My question is, why am I getting this error?
It would be more helpful to have the output of the crash. With that said I suspect your storyboard still has an outlet hooked up, referencing the function or outlet you created. From your storyboard click on your textfield and then navigate to the connections inspector (view -> utilities -> connections inspector). From there you should be able to see any connections you have made. Click the x to get rid of it.
The connection inspector is the icon in the upper right with the right facing arrow inside of a circle.
Edit:
I realized you asked why this is happening and not how to fix it. Unrecognized selector means just what it sounds like. Your code, in this case the storyboard is trying to call a method or access a variable on an object that doesn't implement that method. Normally the compiler catches these types of errors in your code but there are cases it can't catch, like the one your experiencing. For example it is ok to assign an NSArray object to a variable declared as something else, say an NSString as follows
id object = #[#"hello", #"world"];
NSString *notAString = object;
[notAString length];
Try running this and it will crash with a similar error because NSArray implement the length method, or in Objective-c speak, it doesn't respond to the selector "length".
Most typically it's this:
Select your UITextField in IB, go to the Connections inspector and remove the ghost connection to the removed method.

UITextField.autocorrectType issue in iOS 7

This is occurring with existing apps running on iOS7 and also with apps compiled in XCode 5.0.
I have recently inherited two iOS apps that were built using the Three20 framework. I realize that this framework is no longer supported, and do eventually want to switch these apps to a different framework. I am trying to simply get them to run under iOS7 before making an infrastructure changes.
The apps use a text field which inherits from a Three20 class, ultimately deriving from UITextField.
The inheritance chain is:
MyAppPickerTextField
TTPickerTextField
TTSearchTextField
UITextField
The apps are crashing when the initWithFrame method of MyAppPickerTextField is called, with the following exception:
* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[MyAppPickerTextField setAutocorrectionType:]: unrecognized selector sent to instance 0xd1c6c30'
It appears that somewhere in the inheritance MyAppPickerTextField is losing UITextInputTraits, which UITextField implements.
I've tried to implement UITextField at all levels of the inheritance chain with no results.
Could it be that the instance of MyAppPickerTextField is getting deleted before that gets called?
Thanks

unrecognized selector sent to instance on deviceOrientationDidChange

Right now my app should only supports Portrait. On Summary/Supported Device Orientations I have only selected Portrait so I'm hoping that my app will not rotate. I was testing the app on a device and suddenly I'm getting the following error randomly:
[UIButtonContent deviceOrientationDidChange:]: unrecognized selector sent to instance
It happens when I rotate the device SOMETIMES, is not consistent, and is not always over UIBUttonContent. I supposed that if I only select Portrait, deviceOrientationDidChange should not be called or should be ignored.
Other times my app crashes with an EXC_BAD_ACCESS (code=1, address=something) but it happens when I rotate the device so I'm guessing that both errors are related.
I don't know what to do with this, it's hard to debug because I don't have feedback, the All Exceptions Breakpoint is not being called, so I don't know where and exactly why this is happening. Any idea on how to debug this is welcome.
These are the classic signs of a memory management error. You have over-released some object and it has been deallocated while something else still references it. Later, something messages it. In some cases a new object has taken its place, but that object doesn't understand the messages it's receiving. In other cases, there's no valid object and you get a crash.
Edited to second the advice to use the Zombies instrument to find the over-release.
Do you have a class that should be called with deviceOrientationDidChange:? When this happens, it usually means that you have a dangling reference to a deallocated object. You should try profiling your app with Instruments in "Zombies" mode.
I solved this issue a long time ago, but I think is good to share what actually helped me on this case.
After trying everything with no results with Instruments I started debugging old-school. I had an idea of "where" the error was so I just commented all the code on that section. I was right, the bug just disappeared along with some functionalities. After that I made "binary uncommenting" (uncomment one half) till I got the bug line. It was a third party library, I had an object that was not being released properly.

handleGetURLEvent:withReplyEvent: in AppDelegate obscured by KVO?

i'm seeing a weird issue trying to add custom URL support to my Mac app. i've defined the URL(s) in Info.plist, and when i navigate to them my app gets launched (or, if running, activated), but then, regardless of whether my app delegate implements handleGetURLEvent:withReplyEvent: or not, i see a couple of the following messages in the debug output:
+[NSKVONotifying_MyAppDelegate handleGetURLEvent:withReplyEvent:]: unrecognized selector sent to class 0x1d096e0
Apparently, NSKVONotifying_MyAppDelegate is a wrapper created by KVO for my real delegate (called MyAppDelegate), and that seems to obscure my implementation of handleGetURLEvent:withReplyEvent:, which never gets called. AFAICT, nothing in my app uses KVO on the delegate, and i'm running out of ideas as to what could be causing this.
any suggestions?
turns out the KVO thing was a red herring. the method needs to be static, as careful reading of the error message (or docs) would have made clear, while i had an instance method (as one would expect, for delegate methods? weird API design choice).

"UITextField isNaturallyRTL"

My iphone app crashes with the following error message:
2010-07-26 16:27:30.402 Nav[814:207]
* -[UITextField isNaturallyRTL]: unrecognized selector sent to instance
0x3947fe0 2010-07-26 16:27:30.403
Nav[814:207] * Terminating app due
to uncaught exception
'NSInvalidArgumentException', reason:
'*** -[UITextField isNaturallyRTL]:
unrecognized selector sent to instance
0x3947fe0'
I can't find the text isNaturally RTL in my program. Any ideas on how to find the bug?
It seems that isNaturallyRTL is an (undocumented) NSString method. At least NSString responds to it.
This may mean that you assign a UITextField to some variable, where you should put in an NSString instead.
BTW: 0x3947fe0 is the pointer to the UITextField that should be an NSString, so if you're totally lost, try to find out which UITextField has that address (e.g. by a dumb NSLog("tf X: 0x%x",tfx);)
I found the problem. It was in this line of code:
[tempValues setObject:textFieldBeingEdited forKey:tagAsNum];
I changed it to the following:
[tempValues setObject:textFieldBeingEdited.text forKey:tagAsNum];
and that's what fixed it.
It's because your UITextField object is somehow assigned to a variable/property which is not supposed to be a UITextField.
It can happen in many different ways.
You might have connected the IB outlet incorrectly. Check your nib in the Interface Builder to see your UITextField is not connected to something strange.
You might have just assigned an UITextField to a variable of a different type. In that case, the compiler should have given you a warning. Correct your code and remove all the warnings.
You might have not correctly done retain/release. Do "build and analyze", and remove all warnings.