Xcode randomly modifies my scheme content

I'm struggling with maintaining source-controlled collaboration when Xcode just cannot make up its mind about how to generate the schemes. I don't edit the scheme and I get these sort of changes in git.

from:
Code Block
<BuildableProductRunnable
runnableDebuggingMode = "0">

to:
Code Block
<RemoteRunnable
runnableDebuggingMode = "2"
BundleIdentifier = "com.apple.Carousel"
RemotePath = "/$(PRODUCT_NAME)">


It's pretty incomprehensible to me, but has anyone run into similar?
Answered by alex55 in 644521022
My ultimate solution was to untrack the scheme files by adding their folder to my gitignore, duplicating them to an adjacent folder, and writing a script which will copy the new folder's contents to the ignored folder (must be run locally for each developer).
Yes, same problem.
Same here too. Xcode 12.1. Even though I'm a team of one, it is still bothersome trying to keep clean commits. I always discard changes on it. Strangely, the next time I open the project, the same changes are not made.
Same problem here as well, any solution so far?
Accepted Answer
My ultimate solution was to untrack the scheme files by adding their folder to my gitignore, duplicating them to an adjacent folder, and writing a script which will copy the new folder's contents to the ignored folder (must be run locally for each developer).
Same problem here, following.
I've been in touch with Apple via Feedback Assistant (FB8756563) since September. Unfortunately, no progress so far.

The issue is easily reproducible even in the latest beta versions of Xcode (12.3 b1). Most likely trigger from my inspections seems to be related to the build process on different simulator devices when switching between them.
For example: First, I run the build process on an iPhone 12 simulator, and after that on the generic device. This almost always changes the schemes. And then if I switch back to the iPhone device, the schemes change again.
I don't claim to know what all the XML means but the change happens in my watch app schemes when I switch the selected device between the simulator and a real watch. When I select the simulator, BuildableProductRunnable is in effect but when I select a real watch, RemoteRunnable is in effect. It's almost as if the scheme has to change to allow remote debugging when using a real watch. So the state of the scheme files depends on the device selected when you last built in Xcode.
Hello, we found out that the reason for this is the iPhone 12 simulators have a Watch paired by default in them. If you look at Simulator lists and select your iPhone 12 (Pro and Pro Max), you will see that a Watch is paired with it. So when you use these simulators, it also builds your watch app scheme, if you have any. So you either delete the watch app from the simulators or keep it and add it in your other simulators making sure that anyone who works with you does the same thing so it doesn't keep on changing.

Hope this help you out!
15
Same here
Having the same problems. It's really annoying and makes clean commit a pain.
Does that script need to be ran every time you open Xcode and something changes? That seems worse than having messy commits.
Removing a paired watch from iPhone simulator seems helped. But it is rather workaround :0

The simplest way I've found to avoid this madness is to always switch to my main app's scheme and select "Any iOS Device" before staging/committing. If that results in a change for you, you'll have to commit that change, but that should be the last time you have to if as long as you always select "Any iOS Device" before staging/committing going forward.

What are the downsides of marking the WatchKit app scheme as not Shared and removing it from git?

I have this same issue with our Watch app schemes and have also submitted a feedback request (FB9832417) the resolution status has been updated to "Potential fix identified - For a future OS update" so hopefully we'll have a fix soon.

Removing it from the repo doesn't work for us since it results in that scheme not showing up in the schemes drop-down. Using git update-index --skip-worktree doesn't work well on a large team since if everyone doesn't do it then it causes issues, and the docs for that command warn that it isn't meant for this type of use case.

My latest workaround is to add a pre-commit hook that discards the changes to those scheme files before committing so that it doesn't show up in our pull requests at least. Still shows up in the local diff before committing which is annoying but it's the best i've been able to work out so far that doesn't depend on everyone aligning on the same behavior.

Xcode randomly modifies my scheme content
 
 
Q