标签未匹配 - Xcode故事板错误

5

在合并冲突后,我需要删除添加到不同文件中的一些字符,但是在我完成此操作后,我遇到了以下错误:

第621行:textView的起始和结束标记不匹配,第557行和subviews相对应

第557行:

<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="0L0-L4-EMJ" userLabel="Job Text View" customClass="RoundText" customModule="Arvice" customModuleProvider="target">

第621行:

</subviews>

代码第557-621行的完整内容如下:
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="0L0-L4-EMJ" userLabel="Job Text View" customClass="RoundText" customModule="Arvice" customModuleProvider="target">
<rect key="frame" x="16" y="372" width="343" height="225"/>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" ambiguous="YES" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="0L0-L4-EMJ" userLabel="Job Text View" customClass="RoundText" customModule="Arvice" customModuleProvider="target">
<rect key="frame" x="16" y="128" width="343" height="325"/>
<color key="backgroundColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="0.75296982020547942" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="225" id="VOt-bF-NX1"/>
</constraints>
<color key="textColor" red="1" green="0.96078431369999995" blue="0.019607843140000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" name="Brandish" family="Brandish" pointSize="18"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="1" green="0.96078431369999995" blue="0.019607843140000001" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="30"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</textView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="grV-x2-o7U" customClass="CustomizableButton" customModule="Arvice" customModuleProvider="target">
<rect key="frame" x="16" y="611" width="343" height="40"/>
<rect key="frame" x="16" y="392" width="343" height="30"/>
<color key="backgroundColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="0.75296982020000003" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="height" constant="40" id="en1-xh-J1M"/>
</constraints>
<fontDescription key="fontDescription" name="Brandish" family="Brandish" pointSize="18"/>
<state key="normal" title="Add "/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<connections>
<action selector="postPressed:" destination="ZTf-cm-rjD" eventType="touchUpInside" id="gEw-Za-Xl5"/>
</connections>
</button>
<view contentMode="scaleToFill" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XAx-Sp-9p1" customClass="GADBannerView">
<rect key="frame" x="0.0" y="64" width="375" height="22"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GVF-qY-rRW">
<rect key="frame" x="99" y="189" width="176" height="175"/>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="tOi-sI-3OX" customClass="RoundLabel" customModule="Arvice" customModuleProvider="target">
<rect key="frame" x="69" y="136" width="290" height="45"/>
<color key="backgroundColor" red="0.43529411759999997" green="0.4431372549" blue="0.47450980390000003" alpha="0.75296982020000003" colorSpace="custom" customColorSpace="sRGB"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="15"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</label>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="tfM-0s-pL1">
<rect key="frame" x="16" y="136" width="45" height="45"/>
<constraints>
<constraint firstAttribute="width" constant="45" id="Tnf-xp-PXp"/>
<constraint firstAttribute="height" constant="45" id="vEc-bG-e1e"/>
</constraints>
</imageView>
</subviews>

问题是什么?您的故事板必须是正确的XML文件,任何结束标记必须与相应的开始标记匹配。 - Serega
我该如何解决这个错误?我需要添加什么?我尝试在第557行添加<subviews>,但是错误仍然存在,只是错误出现在之后的下一行,这意味着错误会显示在第558行和622行... - J. Doe
没有完整的故事板代码,无法准确回答这个问题。但我建议你在557行和621行之间没有关闭textView标签。 - Serega
我想最好将Storyboard恢复到之前的提交,而不是通过XCode对其进行更改。 - Ali Kıran
你解决了这个问题吗? - yasin89
显示剩余3条评论
1个回答

9
你有两个具有相同id="0L0-L4-EMJ"的textView标签,但只有一个结束标签。看起来像是合并问题。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接