xcstrings CFBundleName value changes after building different target

Hi,

I followed Xcode’s recommendation and migrated to the new strings format (*.strings → *.xcstrings) using the Migrate to String Catalog option.

My project has two build targets:

  • MyAppName
  • MyAppNameVFSCopy

Every time I build one or the other target, the value in the .xcstrings file changes under CFBundleName > en > stringUnit > value, switching between MyAppName and MyAppNameVFSCopy. As a result, Git detects a change in source control each time, which is quite annoying.

How can I prevent this from happening?

After building MyAppNameVFSCopy target, the "value" is MyAppNameVFSCopy

    "CFBundleName" : {
      "comment" : "Bundle name",
      "extractionState" : "extracted_with_value",
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "new",
            "value" : "MyAppNameVFScopy"
          }
        }
      }
    }

After building MyAppName target, the "value" changes to MyAppName

    "CFBundleName" : {
      "comment" : "Bundle name",
      "extractionState" : "extracted_with_value",
      "localizations" : {
        "en" : {
          "stringUnit" : {
            "state" : "new",
            "value" : "MyAppName"
          }
        }
      }
    }

Deleting CFBundleName from *.xcstrings file didn't help. CFBundleName is automatically created again after building target.

Both targets has it's on plist file. In those files:

	<key>CFBundleName</key>
	<string>${PRODUCT_NAME}</string>

Attaching full xcstrings file

Solution: I updated the CFBundleName in both Info.plist files to use the same value — "MyAppName" — to prevent constant changes in the xcstrings file during builds.

xcstrings CFBundleName value changes after building different target
 
 
Q