While developing iOS apps, you may come across a situation where you have an old Xcode version while your physical device is running on a newer iOS version which is not supported by Xcode. In such scenario, you will need to manually add device support files to your Xcode installation so it could build and run apps on your device iOS version.
Testing mobile apps in Xcode is a big issue with simulators. They are slow and besides, you actually have to test the apps on device anyway, but if your iPhone iOS version does not match with the Xcode, e.g. Xcode 10.1 requires matching iOS 12.1 on your device, you are going to see this error message. >>
Could not locate device support files. This iPhone 5s (Model A1457, A1518, A1528, A1530) is running iOS 12.4.6, which may not be supported by this version of Xcode.
There are several ways to resolve this issue:
- Upgrade Xcode to latest version, but it might not be possible for some, because latest Xcode requires you to be on Mojave or Catalina macOs which do not install on unsupported versions of MacBook machines. or you do not have enough space or time to download huge latest Xcode download.
- Download Device Support files and place them in the required folder in the Xcode and it will resolve the error for testing file on your iPhone or devices.
Download Device Support Files
Apple ha snot provided any official source from where you can download and add device support files in your Xcode. There are some community maintained repos or drives, GitHub from where you can get them. Here is the repository holds the device support files for the iOS, and updated regularly. https://github.com/iGhibli/iOS-DeviceSupport
Go ahead and select the version that you need, and download the device support files required for your iOS version. You may not find the exact match e.g. 12.4.6 but 12.4.x works.
Place the Downloaded files in Xcode Installation
Go to the location Applications > Xcode > Right Click > Show Package Contents > Contents > Developer > Platforms > iPhoneOS.platform > DeviceSupport
as shown in the following screenshot and placed the unzipped directory. inside DeviceSupport directory.
You may have to restart the Xcode and it may take few minutes first time when you would try to test the app on your device.
I installed device support files for two iPhones, one had 12.4.6 and other had 13.4, for my Xcode version 10.1 which did not support both later 12.4.6. and 13.4 versions on iPhones.
This solution worked for both and now I can test on device rather than slow and unresponsive simulators.
Hope that helps.