'NSInvalidArgumentException', reason: '-[UISearchBar searchTextField]: unrecognized selector sent to instance - ios

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UISearchBar searchTextField]: unrecognized selector sent to instance 0x7f8ebaf60cf0'
How do I know which is this view 0x7f8ebaf60cf0?
I was doing PO 0x7f8ebaf60cf0
and it returns this 140250998770928
Then I needed more info like recursiveDescription but I can't get further. How can I start debugging such a bug?

The problem is that searchTextField is iOS 13 only. On iOS 12 and before it compiles, runs, and crashes. Just do a global search for searchTextField and don’t use it under iOS 12 or earlier.

Take a look https://learnappmaking.com/unrecognized-selector-sent-to-instance-swift-development/
Basically these errors occurs when you try to access an object which is nil.
I think in your case it happens because [UISearchBar searchTextField] ,Here searchTextField is no function.

Related

unrecognized selector with UILocalizedIndexedCollation.current().section(for:collationStringSelector:#selector(getter: UIPreviewAction.title))

This code I use with my indexing feature on a table view is generating a runtime error:
let collation = UILocalizedIndexedCollation.current()
sectionNumber = collation.section(for: tssContact, collationStringSelector: #selector(getter: UIPreviewAction.title))
The error occurs in the second line in my code above. The error says:
2017-10-03 01:41:40.997296-0500 MailToText[6504:13026014]
-[MailToText.TSSContact title]: unrecognized selector sent to instance 0x604000481090 2017-10-03 01:41:41.020775-0500
MailToText[6504:13026014] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason:
'-[MailToText.TSSContact title]: unrecognized selector sent to
instance 0x604000481090'
How do I fix this. It was working before I went to Swift 4 and made the recommended adjustments to settings going to Xcode 9.
I figured it out. I looked at the error message where it says [MailToText.TSSContact title] and found TSSContact.title in my project, and put "#objc" next to "var title" in the class TSSContact.
That fixed it.

Terminating app due to uncaught exception 'NSInvalidArgumentException' , reason: '-[NSNull _fastCStringContents:]: unrecognized selector

I created a new tabbed application in Xcode. I am receiving the following error every time I try to type any letters or numbers into a text field.
I noticed that this error started when I checked the box for "is initial view controller"
When i have the ViewController itself set as the initial ViewController it will not throw the error. However, when I make a NavigationController the initial ViewController it will throw this error.
Error received:
Reminder[46707:4165261] -[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10d087af0
2016-03-23 00:48:19.830 Cable tech Reminder[46707:4165261] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSNull _fastCStringContents:]: unrecognized selector sent to instance 0x10d087af0'
For me this issue was caused because I inadvertently clicked on the Key Commands controls in the attribute inspector. I did not create any commands, but having and empty entry caused any input into a textField to crash.
Solution :-
1) Right click on storyboard and open as source code.
2) Search for keyCommands and delete that empty keyCommands tag.
3) Clean and Run.
This solved my problem, I hope it will be helpful for you as well.
Cheers

[__NSConcreteURLComponents queryItems]: unrecognized selector

I'm getting this error trying to run a bare project from the react-native init command, on an iOS 7.1 device.
This works on the iOS simulator, so I wonder if its an iOS compatibility issue?
The Movies example app works ok on this device.
```
2016-01-08 16:34:33.224 CouchTest[1210:60b] -[__NSConcreteURLComponents queryItems]: unrecognized selector sent to instance 0x14dacc10
2016-01-08 16:34:33.226 CouchTest[1210:60b] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSConcreteURLComponents queryItems]: unrecognized selector sent to instance 0x14dacc10'
* First throw call stack:
(0x2edb0f83 0x39561ccf 0x2edb4917 0x2edb3203 0x2ed02768 0x10abaf 0xb47a1 0xb1735 0xb0c8b 0x39a49833 0x39a4981f 0x39a49777 0x2ed7b8a1 0x2ed7a175 0x2ece4ebf 0x2ece4ca3 0x33bea663 0x3163114d 0x9780d 0x39a6eab7)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
```
NSURLComponents queryItems is only available on iOS8+
That's why you are seeing the crash.
See the docs here for more info: https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSURLComponents_class/index.html#//apple_ref/occ/instp/NSURLComponents/queryItems
Setting an exception breakpoint will show you which class/method is making that call. Otherwise, it sounds like react-native is calling queryItems when it shouldn't.

App crashes on iPad simulator

I am building a universal app. App is working fine for iPhone 5 and iPhone 4(different storyboard) but it crashes when trying to run it for iPad 6.1
This is the error:
-[AccountTableViewController topViewController]: unrecognized selector sent to instance 0xab52620
2013-08-19 21:13:35.527 [6871:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AccountTableViewController topViewController]: unrecognized selector sent to instance 0xab52620'
*** First throw call stack:
(0x2131012 0x1c26e7e 0x21bc4bd 0x2120bbc 0x212094e 0x2c1a 0xb68157 0xb68747 0xb6994b 0xb7acb5 0xb7bbeb 0xb6d698 0x2b10df9 0x2b10ad0 0x20a6bf5 0x20a6962 0x20d7bb6 0x20d6f44 0x20d6e1b 0xb6917a 0xb6affc 0x252d 0x2455)
libc++abi.dylib: terminate called throwing an exception
You are calling a UINavigationController method topViewController on a UITableView instance AccountTableViewController.
Without code, it's a little difficult to be more specific, but maybe you want to be calling this method on the UITableView's navigation controller?

iOS Button Target Actions with Block Crashes

I'm implementing UIButtons with block actions set on them for connivence and speed of integration. I've used this method before, a while ago now, and had little issue with it. Now, however, i'm facing an issue where integrating...
https://gist.github.com/2468899
... into my app now crashes it on launch. The error i'm receiving is as follows...
2012-09-27 22:18:47.459 flink[12174:907] -[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610
2012-09-27 22:18:47.460 flink[12174:907] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIButton setAction:withBlock:]: unrecognized selector sent to instance 0x1e8ae610'
*** First throw call stack:
(0x3885a3e7 0x333bf963 0x3885df31 0x3885c64d 0x387b4208 0xea477 0xff6af 0x36b92cb1 0x3882f8f7 0x3882f15d 0x3882df2f 0x387a123d 0x387a10c9 0x3868c33b 0x34014289 0xe7b8f 0xe7b30)
libc++abi.dylib: terminate called throwing an exception
... i've never seen this issue before but it's odd that it is immediately crashing without any interaction.
Thanks in advanced.
You must make sure to add the implementation file of the category to your target. In Xcode, go to the File Inspector and make sure the Target Membership checkbox for your target is checked.

Resources