[UILabel copyWithZone:]: unrecognized selector sent to instance
I guess this was one of those weird bugs with Xcode that you can't trace or reproduce every time. I narrowed the issue down to one specific UILabel in the IB. As soon as I connect it to an IBOutlet UILabel *
, I get this error.
On further investigation, it turns out that name title
was causing the issue. I had the label declared as
IBOutlet UILabel *title;
As soon as I changed the name to gtitle
, everything worked as expected. Who knows?..
Swift 5 in my Case
YOURBUTTON.addTarget(self, action: #selector(funCross), for: .touchUpInside)
//MARK:- My Function
@objc func funWithSearch(screen: String)
{
}
if you focus on #selector(funCross) i am calling a function without object
when i use this its work fine
YOURBUTTON.addTarget(self, action: #selector(funTemp), for: .touchUpInside)
//MARK:- My Function
@objc func funTemp()
{
funWithSearch(screen: "etc your desire string")
}
//MARK:- My Function
@objc func funWithSearch(screen: String)
{
}