From Xcode 11 onwards, my whole App is getting stuck while I turn the UISwitch ON/OFF.

When I turn the UISwitch ON/OFF my whole App is getting stuck. First I thought, it is because of my code, but I removed all connections and code to the UISwitch, but the issue is still occouring. Is there any solution for this?

I removed all connections and code to the UISwitch


So, what is the conf now ?

- you have a UISwitch in IB, right ?

- it is not connected to anything , right ?

Can you explain precisely how you removed the connections ? It is not correct to just remove the IBActions, need to remove from the switch (right click on UISwitch to see the connections list)

Note: did you do an oprtion-clean build folder after removing the connections ?

- So, now the switch should just toggle on / off, without doing anything.


Do you get a crash message ?


After doing the clean, if it does not work,

- remove the UISwitch from the view.

Does your app crash ?

- create a new UISwitch and test again.

What happens ?


Note: you seem to have similar problem with UISegmentedControl, so there is something damaged either in XCode, in simulators or in your system.

  • Which version of MacOS ?
  • Which XCode version ? 11.x, which exact version ?
  • Do you run on simulator or device ?
  • which iOS version ?

Actuly I deleted the UISwitch from the storyboard and re-added it on the storyboard without any connections. But still I am getting this issue. App is not getting crash. it is not responding or it is not taking any touch events so it feels like stuck.

  • Which version of MacOS ? : Catalina (10.15).
  • Which XCode version ? 11.x, which exact version ? : 11.2.1 (But the issue occouring from 11.0.0 onwards).
  • Do you run on simulator or device ? : I tried it in both Simulator and Device.
  • which iOS version ? : tested in 12 and 13

UISwitch is such a basic function that it is highly unlikely there is a bug. We would have seen a lot of posts about it.


May be there is something in the project.

Could you create a completely new project with just a switch, no connection to code and check if you get stuck ?


If not, there is something in your project.


If yes, can you test with another version of XCode ?

Does it work ?


If OK or if you have no other XCode, you should reinstall XCode.


PS: Is it Swift with Storyboard or SwiftUI ?

From Xcode 11 onwards, my whole App is getting stuck while I turn the UISwitch ON/OFF.
 
 
Q