Description

Since multiple dict tags can be in a plist, not just the top level, need to be able to specify to only insert once.

Adding an optional once="true" attribute to these commands in UPL will allow this.

Steps to Reproduce

1. Create iOS code project
2. Add this to the project's Build.cs:

if (Target.Platform == UnrealTargetPlatform.IOS)
{
                string PluginPath = Utils.MakePathRelativeTo(ModuleDirectory, BuildConfiguration.RelativeEnginePath);
                AdditionalPropertiesForReceipt.Add(new ReceiptProperty("IOSPlugin", Path.Combine(PluginPath, "Test_UPL.xml")));
}

And add this Test_UPL.xml file:

<?xml version="1.0" encoding="utf-8"?>
<root>
	<!-- init section is always evaluated once per architecture -->
	<init>
		<log text="Test UPL init"/>
		<setString name="APIKey" value="testkey"/>
	</init>
	
	<iosPListUpdates>
		<!-- Add Fabric.io ApiKey -->
		<addElements tag="dict" once="true">
			<key>Fabric</key>
		</addElements>
		<setElement result="FabricKey" xml="&lt;dict&gt;&lt;key&gt;APIKey&lt;/key&gt;&lt;string&gt;$S(APIKey)&lt;/string&gt;&lt;key&gt;Kits&lt;/key&gt;&lt;array&gt;&lt;dict&gt;&lt;key&gt;KitInfo&lt;/key&gt;&lt;dict/&gt;&lt;key&gt;KitName&lt;/key&gt;&lt;string&gt;Crashlytics&lt;/string&gt;&lt;/dict&gt;&lt;/array&gt;&lt;/dict&gt;"/>
		<addElement tag="dict" name="FabricKey" once="true"/>
	</iosPListUpdates>
</root>

3. Package for iOS and look at the plist file to make sure the fabric key is only inserted once instead of for every dict block.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-47951 in the post.

5
Login to Vote

Fixed
ComponentUE - Platform - Mobile
Affects Versions4.174.18
Target Fix4.17
Fix Commit3569317
Main Commit3596628
Release Commit3569317
CreatedAug 1, 2017
ResolvedAug 2, 2017
UpdatedSep 16, 2019