I found that you have to be patient. After checking "Connect via network" and disconnecting the cable, it will say "Disconnected" above the device in the left panel of the Devices and Simulators window. You need to wait until it says "Connected" again (without plugging in the cable). This can take 30-60 seconds. After that, it should work.