daniel
daniel

Reputation: 966

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.

Upvotes: 0

Views: 210

Answers (1)

daniel
daniel

Reputation: 966

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.

Upvotes: 0

Related Questions