Skip to content
This repository was archived by the owner on May 17, 2019. It is now read-only.

Commit 06e6c03

Browse files
author
Adam Cummings
committed
Prevent Plist Post Processor from overriding properties
Differential Revision: https://phabricator.twitter.biz/D76207
1 parent 8d29892 commit 06e6c03

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

source/Assets/Twitter/Editor/TwitterPostProcess.cs

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828

2929
public class TwitterPostProcessBuild {
3030

31+
private const string URL_TYPES = "CFBundleURLTypes";
32+
private const string URL_SCHEMES = "CFBundleURLSchemes";
33+
private const string APPLICATION_QUERIES_SCHEMES = "LSApplicationQueriesSchemes";
34+
3135
[PostProcessBuild]
3236
public static void UpdateXCodePlist(BuildTarget buildTarget, string pathToBuiltProject) {
3337
#if UNITY_IOS
@@ -48,11 +52,17 @@ public static void UpdateXCodePlist(BuildTarget buildTarget, string pathToBuiltP
4852
PlistElementDict rootDict = plist.root;
4953

5054
// Modify Info.Plist for Twitter Kit (https://dev.twitter.com/twitterkit/ios/installation)
51-
PlistElementArray bundleURLTypesArray = rootDict.CreateArray ("CFBundleURLTypes");
55+
PlistElementArray bundleURLTypesArray = rootDict[URL_TYPES] as PlistElementArray;
56+
if (bundleURLTypesArray == null) {
57+
bundleURLTypesArray = rootDict.CreateArray (URL_TYPES);
58+
}
5259
PlistElementDict dict = bundleURLTypesArray.AddDict ();
53-
PlistElementArray bundleURLSchemesArray = dict.CreateArray ("CFBundleURLSchemes");
60+
PlistElementArray bundleURLSchemesArray = dict.CreateArray (URL_SCHEMES);
5461
bundleURLSchemesArray.AddString ("twitterkit-" + TwitterSettings.ConsumerKey);
55-
PlistElementArray queriesSchemesArray = rootDict.CreateArray ("LSApplicationQueriesSchemes");
62+
PlistElementArray queriesSchemesArray = rootDict[APPLICATION_QUERIES_SCHEMES] as PlistElementArray;
63+
if (queriesSchemesArray == null) {
64+
queriesSchemesArray = rootDict.CreateArray (APPLICATION_QUERIES_SCHEMES);
65+
}
5666
queriesSchemesArray.AddString ("twitter");
5767
queriesSchemesArray.AddString ("twitterauth");
5868

0 commit comments

Comments
 (0)