How to add items to Custom PList?

I’m trying to add the following to my PList, using the “Custom PList” field in Projucer:

<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>localhost</key>
            <dict>
                <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>

However it does not show up in XCode and I have to enter it manuall after project save. Am I doing it wrong?

1 Like

try to enter the whole xml:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist>
  <dict>
    <key>CFBundleName</key>
    <string>MyGreatBundleName</string>
  </dict>
</plist>
1 Like

You don’t need the first two lines with <?xml ...> and <!DOCTYPE ...>

But yes you do need the whole <plist>...</plist> part

1 Like

Had to look this up too.
Would be clear right from the start if this text was added to the explanation at the bottom:
This expects the <plist> element (with its child elements). The <?xml ...> or <!DOCTYPE ...> tags are not needed.

2 Likes

I was unable to get the custom plist to work with the following plist:

<plist version="1.0">
    <key>NSAppTransportSecurity</key>
	    <dict>
		        <key>NSAllowsArbitraryLoads</key>
	        	<true/>
	    </dict>
</plist>

I entered my plist values directly into xcode, opened up the plist with a text editor and copied that segment into the Custom PList field. When i saved/opened my project and selected the Info-App.plist XCode responded: “The data couldn’t be read because it isn’t in the correct format”

If i delete the ‘version="1.0"’ bit, i still get the same error message. If i delete the <plist> </plist>, i still get the same error. If It just contains the <key> <dict/> tags, xcode doesn’t parse the plist and my custom parameters aren’t stored. Seems like this Projucer feature needs some more work or at lease some better documentation for how to use it.

If it helps at all, this is what the Info-App.plist looks like with that custom plist data saved. you can see the dict for NSAppTransportSecurity isn’t being saved properly. the </dict> tag is not being included from the custom plist.

<plist version="1.0">
  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
    <key>CFBundleExecutable</key>
    <string>${EXECUTABLE_NAME}</string>
    <key>CFBundleIconFile</key>
    <string></string>
    <key>CFBundleIdentifier</key>
    <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
    <key>CFBundleName</key>
    <string>MidiRecorder</string>
    <key>CFBundleDisplayName</key>
    <string>MidiRecorder</string>
    <key>CFBundlePackageType</key>
    <string>APPL</string>
    <key>CFBundleSignature</key>
    <string>????</string>
    <key>CFBundleShortVersionString</key>
    <string>1.0.0</string>
    <key>CFBundleVersion</key>
    <string>1.0.0</string>
    <key>NSHumanReadableCopyright</key>
    <string></string>
    <key>NSHighResolutionCapable</key>
    <true/>
  </dict>
</plist>

This is what it SHOULD look like (after adding custom plist entries via xcode)

	<plist version="1.0">
	<dict>
		<key>NSAppTransportSecurity</key>
		<dict>
			<key>NSAllowsArbitraryLoads</key>
			<true/>
		</dict>
		<key>CFBundleExecutable</key>
		<string>${EXECUTABLE_NAME}</string>
		<key>CFBundleIconFile</key>
		<string></string>
		<key>CFBundleIdentifier</key>
		<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
		<key>CFBundleName</key>
		<string>MidiRecorder</string>
		<key>CFBundleDisplayName</key>
		<string>MidiRecorder</string>
		<key>CFBundlePackageType</key>
		<string>APPL</string>
		<key>CFBundleSignature</key>
		<string>????</string>
		<key>CFBundleShortVersionString</key>
		<string>1.0.0</string>
		<key>CFBundleVersion</key>
		<string>1.0.0</string>
		<key>NSHumanReadableCopyright</key>
		<string></string>
		<key>NSHighResolutionCapable</key>
		<true/>
	</dict>

THIS!

We need a working example, maybe in the ‘show text when empty’ of the projucer here … I’m still f**king around trying to make this work and hitting errors… :slight_smile:

Actually - I think there’s a projucer bug at play here too.

… I take it back. There isn’t.

1 Like

@jules @ed95 we found a bug!

1 Like

Oh hang on… maybe I speak too soon…

It’s not a bug … it’s just really difficult to figure out what’s needed :wink:

At least if you’re not some kind of info.plist wizard, something I hope not to become :wink:

<plist version="1.0">
  <dict>
  <key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>
    </dict>
</plist>

In the Custom Plist box is all you need to disable apples sensible security requirements and go shooting yourself in the foot with unencrypted connections…

Now I can go back to my even less favourite task of making an installer.

2 Likes

ah i see.

This plist is needed so you can connect to anything running on localhost.

can we get a +1 for a JuceInstallerBuilder???

+1 for this.

However, have you any idea how to get specific domains whitelisted, rather than the blanket approach of NSAllowsArbitraryLoads?

After much trawling through SO, I have the xml below… but it still doesn’t seem to be working. And now on top of this I can’t get ProJucer and Xcode to play nicely with the info-App.plist file… This really needs to be clearer!

<key>NSAppTransportSecurity</key>
<dict>
	<key>NSAllowsArbitraryLoadsInWebContent</key>
	<false/>
	<key>NSAllowsArbitraryLoads</key>
	<false/>
	<key>NSExceptionDomains</key>
	<dict>
		<key>[domain.mycompany.net]</key>
		<dict>
			<key>NSIncludesSubdomains</key>
			<true/>
			<key>NSExceptionAllowsInsecureHTTPLoads</key>
			<true/>
			<key>NSExceptionMinimumTLSVersion</key>
			<string>TLSv1.1</string>
		</dict>
	</dict>
</dict>

I have almost the same XML and it works for me. The only difference is that I haven’t specified that NSExceptionMinimumTLSVersion key.

Beware, though, that these settings only apply for stand-alone applications: if yours is a plug-in, then most likely it inherits those settings from the loading process and you are pretty much at the mercy of the host then!

(I’ve been hit by this in an earlier version of Studio One, but now they have specified NSAllowsArbitraryLoads in their Info.plist so this is not an issue any more with that host)

Thanks for the reply!

I think I figured it out, it seems I needed the <plist></plist> xml tags, and then a <dict></dict> inside that… giving my working xml file as:

<plist>
<dict>
<key>NSAppTransportSecurity</key>
    <dict>
        <key>NSExceptionDomains</key>
        <dict>
            <key>[domain.mycompany.net]</key>
            <dict>
                <key>NSIncludesSubdomains</key>
                <true/>
                <key>NSExceptionAllowsInsecureHTTPLoads</key>
                <true/>
            </dict>
        </dict>
    </dict>
  </dict>
</plist>

Beware, though, that these settings only apply for stand-alone applications

Thanks for the info! fortunately mine is a stand alone application so all is good:)

1 Like