I am working through the process of getting an app provisioned to the App Store but I am new to iOS development and the Apple ecosystem. I have acquired a device which allowed me to do the automatic certificate stuff. However, when I try and build the app on the device (which I need to do to debug as not everything works in the simulator) I get an error saying Could not locate device support files.
I am running Xcode 16.2 but the iPhone I have is iOS 14.8.1. While in the Xcode details it says Xcode 16.2 can target iOS 13-18.2 if I look in /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/ sure enough the supported versions only go back to 15.
I can find some info on how to deal with this if you have an older version of Xcode that does not have newer iOS version device support files but not the other way round. There is a link to a bunch of support files here but not sure it is legit plus it doesn't contain 14.8.1. Any pointers for this very confused Apple noob?
So it turns out there was relevant information in this answer to my question. But for ref this is what i had to do.
Go to this download page on apple (requires developer login).
Download Xcode 15.3
Go to ~/Downloads/
xip --expand Xcode_15_3.xip
(note there is a message about signing certificate and nothing happens for a while but it worked eventually)
cp -R Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/14* /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/DeviceSupport/
this gave me operation not permitted so from this answer I had to...
reboot your mac and press ⌘+R when booting up. Then go into Utilities > Terminal and type the following commands:
csrutil disable reboot
This is a result of System Integrity Protection. More info here.
Then the cp worked.
At this point I rebooted and started vscode and I was able to run my flutter app on my device*
*Note I had to do a couple of other things before it actually worked:
Enter your Mac Login Password and Choose "Always Allow"
One or More dialogs opened and positioned in the same dialog, repeat step 1 until all dialogs closed. (So you thought your password wrong but repeat "Always Allow" with your Mac login password tricky part :) )
Note by the time i realised i had several dialog boxes open and they were all on top of eachother and the wrong one was at the top... I had to move them all around and find the current one and go through them in order.
2. I got an error about 'iproxy cannot be opened' - from this answer i got
I finally found this could fix, first switch to the folder of flutter(change the path to your own flutter path):
cd FLUTTER SDK DIRECTORY/flutter/bin/cache/artifacts/usbmuxd
then execute this command:
sudo xattr -d com.apple.quarantine iproxy
Honestly this was one of the most complicated things I have ever had to do as a developer. I thought macs were supposed to make everything easy!