If your iPhone WiFi button is grayed out and won't turn on, it could be due to a software glitch or a hardware issue. Here are some possible solutions:
Restart your iPhone: Press and hold the volume and side buttons at the same time until the power off slider appears. Then turn off your phone and wait for 30 seconds before pressing the power button to restart your phone.
Enable airplane mode and disable it: Airplane mode can be enabled and turned off later via the Control Center or Settings menu.
Reset network settings: In Settings, select General> Restore> Reset Network Settings. This will delete all saved wifi networks and other network settings.
Reset all settings: If resetting network settings doesn't resolve the issue, you can try restoring all settings. This will reset all settings, but it won't affect apps and data.
Update to the latest iOS version: Update to the latest iOS version by connecting to your computer and using iTunes or Finder.
Fix iPhone system issues in one click: If none of the above methods work, you can try to use a third-party tool, such as FoneGeek Apple System Repair Tool, to fix possible system issues.
In addition to this, the following checks are also recommended by official Apple support**:
Make sure that your router is turned on and that you're in range.
In Settings > Wi-Fi, make sure that WiFi is turned on and try to connect to your network.
If prompted for a wifi password, enter the correct password.
Check if there is a problem with your Wi-Fi network.
Restart your iOS device, router, and modem.
If none of the above steps resolve the issue, it is recommended to contact Apple's official technical support for further assistance.
If you're still having trouble resolving the issue after following the steps above, you may want to consider taking your device to your service provider for inspection, as this could be the result of a hardware failure.