Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Merge causes XML issue in Main Storyboard iOS

Tags:

merge

ios

xml

After a merge gone wrong I am getting an error:

Interface Builder Storyboard Line 3166: StartTag: Invalid element name

Here is line 3166 in the XML:

                            <include reference="mg7-MW-AgG"/>
                                <include reference="W21-pW-ZnG"/>
                                <include reference="e3g-wW-DtJ"/>
                                <include reference="u5V-a3-6xi"/>
                            </mask>
                        </variation>
                    </view>
<<<<<<< HEAD
                    <tabBarItem key="tabBarItem" title="Rooms" image="55FD63F5-732A-439B-877F-1706F6988CF7" selectedImage="55FD63F5-732A-439B-877F-1706F6988CF7" id="xhN-9a-8cf"/>
=======
                    <tabBarItem key="tabBarItem" title="Rooms" image="55FD63F5-732A-439B-877F-1706F6988CF7" selectedImage="55FD63F5-732A-439B-877F-1706F6988CF7" id="xhN-9a-8cf"/>
>>>>>>> origin/Develop
                    <connections>
                        <outlet property="roomSearchBar" destination="BM4-2v-IaL" id="kH8-j7-2Qh"/>
                        <outlet property="tViewRooms" destination="wPf-94-ZeE" id="lDI-zg-WK5"/>

The line that says <<<<<<< HEAD is line 3166

As you can see there are 2 identical tabBarItems. I tried removing one along with the a few other lines, but I am afraid I'll mess something up.

Any ideas what to do here?

Thanks a lot.

EDIT

I also notice a similar thing happening 600 lines down

<<<<<<< HEAD
        <image name="55FD63F5-732A-439B-877F-1706F6988CF7" width="24" height="24">
=======
        <image name="0F637DAF-B54F-4BF7-81AC-038AB16B6A9A" width="24" height="24">
>>>>>>> origin/Develop

except this time the image names aren't identical. Is this causing the merge conflict?

like image 633
Greg Peckory Avatar asked Nov 18 '25 07:11

Greg Peckory


1 Answers

If it's just those two locations, you'll need to pick which of the pairs are the lines you wish to keep. Then you'll need to delete the merge annotations ("<<<<<< HEAD", ">>>>>>> origin...", etc.) to get yourself back to valid XML in your storyboard.

So

                    </view>
<<<<<<< HEAD
                    <tabBarItem key="tabBarItem" title="Rooms" image="55FD63F5-732A-439B-877F-1706F6988CF7" selectedImage="55FD63F5-732A-439B-877F-1706F6988CF7" id="xhN-9a-8cf"/>
=======
                    <tabBarItem key="tabBarItem" title="Rooms" image="55FD63F5-732A-439B-877F-1706F6988CF7" selectedImage="55FD63F5-732A-439B-877F-1706F6988CF7" id="xhN-9a-8cf"/>
>>>>>>> origin/Develop

would simply become

                    <tabBarItem key="tabBarItem" title="Rooms" image="55FD63F5-732A-439B-877F-1706F6988CF7" selectedImage="55FD63F5-732A-439B-877F-1706F6988CF7" id="xhN-9a-8cf"/>

And then

<<<<<<< HEAD
        <image name="55FD63F5-732A-439B-877F-1706F6988CF7" width="24" height="24">
=======
        <image name="0F637DAF-B54F-4BF7-81AC-038AB16B6A9A" width="24" height="24">
>>>>>>> origin/Develop

would become either:

        <image name="55FD63F5-732A-439B-877F-1706F6988CF7" width="24" height="24">

OR

         <image name="0F637DAF-B54F-4BF7-81AC-038AB16B6A9A" width="24" height="24">

depending on which image was the one that should be there.

Honestly, our team almost never tries to merge changes in storyboards / XIBs. It frequently corrupts the file. If you're making minor changes and you get a merge conflict, simply discard the local changes, update to the latest, and then re-implement your storyboard changes.

This can be especially challenging when there are larger changes, which is why storyboards (which are essentially collections of XIBs) can be difficult to maintain in a multi-team member environment. With Xcode 7 you can mitigate this a bit by using multiple storyboards along with storyboard references.

like image 175
wottle Avatar answered Nov 20 '25 19:11

wottle



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!