Here's a solution for anyone facing this issue.
Before this issue happened below are the version I was working with which was working fine:
XCode 15.0.1
macOS: Ventura 13.5
iPhone 17.0 (I'm using the same iPhone)
Out of nowhere, I started facing this issue and I have tried checking in iPhone and MacBook if any update was installed automatically without my knowledge but nothing was installed since I have already disabled automatic updates in both iPhone and MacBook.
Below are the Steps I did to fix this Issue. I hope it helps at least one of the dev who's facing this issue.
The first step is to check with the system administrator if you are using the company’s MacBook. For security reasons, they might have blocked the ports on the MacBook, which will affect the Mac's ability to recognize the iPhone.
Tried stop the USB related program running in the background using activity indicator and reconnecting the iPhone. Follow this thread. Didn't work for me anyway
I have tried restarting iPhone and Mac, Cleared Derived Data, Cache and all the things which developer will do to fix this. Didn't work
Started following instructions which contain basis troubleshooting steps which apple mentioned. Here's instruction1 and instruction2. Both didn't work.
Updated iPhone to latest verison (17.3.1). didn't work.
Update Mac to latest MacOS Sonoma 14.3.1. didn't work.
I have tried to zooming in on the issue. Makes sure it's not issue with Cable. My cable and iPhone was working perfectly with other macbook pro. By doing this I was able to come to conclusion that issue is with macBook not my iPhone.
After Finally gave up, I have connected with Apple support staff or advisors in a hope to get a solution to this. I was on chat/call with them for 6 hours. They keep transferring to other team, senior, via call, chat mail and support staff keep asking me do the same troubleshooting steps which I have already mentioned on the above points. Waste a whole lot of time in a hope to get a solution to this. None of their solutions worked. I have mentioned their suggestions below if it helpful for anyone.
Support Team suggested to Logout of current User and create some test user and connect with iPhone which didn't work. Here an link of article on how to do that.
Support Team suggested me reinstall mac OS(data will still be in mac only OS will be reinstalled which took 2 hour). Didn't Work. Here article link on how to do that.
Apple Support Team suggested me to Start Mac in safe mode. Which also didn't work. Article here to follow
Last step, Finally I gave up with apple support and decided to do reset the entire MacBook after backing up important files to into drive. After formatting the entire Mac which wiped out all data (application data, files, dependencies, etc). After that I have tried connecting with my iPhone with MacBook and it finally WORKED. I have wasted 2 days on this issue. Hope this help someone
Thanks for reading. React out if you have found any other way to fix this.