info.plist adding a key

2020-05-03 00:59发布

问题:

Very simple question: How do I add this to info.plist? There's multiple info.plist files and all I can see is how to add a row.

<key>NSAppTransportSecurity</key>
<dict>
    <key>NSAllowsArbitraryLoads</key>
<true/>
</dict>

回答1:

If you have multiple targets, each target has a separate PList file with name [TARGET-NAME]-Info.plist.

You can add this by clicking the plus icon, then write NSAppTransportSecurity under "key" and choose type to be a dictionary. Then open it (arrow on the left should be facing down) and click the plus icon of that row, this will add a new entry under the NSAppTransportSecurity entry. Now you should write NSAllowsArbitraryLoads at the newly created entry and choose it to be a boolean with value YES.

If you're editing the file with an external editor, you can just paste the above code before the last </plist> tag.