UnityAppNameLocalizationForIOS
UnityAppNameLocalizationForIOS copied to clipboard
Build errors with XCode 10
I recently upgraded to XCode 10 and am now receiving a build error:
:-1: Multiple commands produce '.../Library/Developer/Xcode/DerivedData/.../en.lproj/InfoPlist.strings':
1) Target 'Unity-iPhone' (project 'Unity-iPhone') has copy command from '.../en.lproj/InfoPlist.strings' to '.../en.lproj/InfoPlist.strings'
2) Target 'Unity-iPhone' (project 'Unity-iPhone') has copy command from '.../en.lproj/InfoPlist.strings' to '.../en.lproj/InfoPlist.strings'
For anyone else reading this who wonders why this happens, it is because Unity automatically adds an "InfoPlist.strings" variant group to the project itself, which contains an en.lproj entry by default. If you also add another en.lproj entry, you'll end up with 2 en.lproj entries in the same Variant group, which xcode 10 will complain about (as @joelbschwartz posted above).
A very fast, hacky solution is to add a function to just remove the unity-generated en.lproj entry from the Variant Group before adding your own. I added this simple function to PBXProject.cs
public void ClearVariantGroupEntries(string variantGroupName) {
PBXVariantGroupData variantGroup = VariantGroupsGetByName (variantGroupName);
if (variantGroup == null)
{
variantGroup = CreateLocalizableVariantGroup (variantGroupName);
}
variantGroup.children.Clear();
}
and made sure to call it with variantGroupName as "InfoPlist.strings" before calling "AddLocalization" as normal.
Thank you for helping! I built it with Xcode 10!
it worked with Xcode 11 too. thanks
it worked. thanks. @megamike55
This fix works with Xcode 12.4 (with Unity 2019.4.19f1)