UnityAppNameLocalizationForIOS icon indicating copy to clipboard operation
UnityAppNameLocalizationForIOS copied to clipboard

Build errors with XCode 10

Open joelbschwartz opened this issue 6 years ago • 5 comments

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'

joelbschwartz avatar Oct 05 '18 12:10 joelbschwartz

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.

megamike55 avatar Feb 14 '19 01:02 megamike55

Thank you for helping! I built it with Xcode 10!

yuiyoichi avatar Feb 18 '19 07:02 yuiyoichi

it worked with Xcode 11 too. thanks

superbderrick avatar Dec 16 '19 07:12 superbderrick

it worked. thanks. @megamike55

inskyfish avatar Jul 26 '20 08:07 inskyfish

This fix works with Xcode 12.4 (with Unity 2019.4.19f1)

tokkoro avatar Mar 16 '21 12:03 tokkoro