I have looked everywhere for the answer but none of the answers seem to fit my problem.
I have a switch statement that references back to a function whenever the case is different:
switch wall["ExposureOneType"] as! String {
case "Twitter":
cell.exposureButtonOne.addTarget(self, action: #selector(self.openThis(urlStr:"https://twitter.com/\(String(describing: wall["ExposureOne"]))")), for: UIControlEvents.touchUpInside)
case "Instagram":
cell.exposureButtonOne.addTarget(self, action: #selector(openThis(urlStr:"https://www.instagram.com/\(String(describing: wall["ExposureOne"]))")), for: UIControlEvents.touchUpInside)
case "Youtube":
cell.exposureButtonOne.addTarget(self, action: #selector(openThis(urlStr:"https://www.youtube.com/user/\(String(describing: wall["ExposureOne"]))")), for: UIControlEvents.touchUpInside)
case "Facebook":
cell.exposureButtonOne.addTarget(self, action: #selector(openThis(urlStr:"https://www.facebook.com/\(String(describing: wall["ExposureOne"]))")), for: UIControlEvents.touchUpInside)
case "Snapchat":
cell.exposureButtonOne.isEnabled = false
default:
cell.exposureButtonOne.isEnabled = false
}
The function openThis() is:
func openThis(urlStr:String!) {
if let url = URL(string: urlStr) {
UIApplication.shared.open(url as URL, options: [:], completionHandler: nil)
}
}
But I am getting the error that is in the title. Any reason why? Any workarounds? All help will be appreciated!