How do I comment lines in .plist file?

IosMacosPlistinfo.plist

Ios Problem Overview


How do I comment out lines in my .plist file in my iOS/Mac projects?

I want to comment out the settings that I don't want to expose for this version of the project, but I may want to expose it later.

Ios Solutions


Solution 1 - Ios

Syntax of plist is pretty much like XML, so you can use XML style comments.

<!--
<dict>
    <key>Hello</key>
    <string>World</string>
</dict> 
-->

Solution 2 - Ios

Xcode seems to believe that the <comment> tag corrupts the data. It will also strip out XML-style <!-- comments --> when viewing the plist in Xcode. It seems that a string entry, e.g.

<key>Comment</key>
<string>My comment</string> 

is the only way to reliably persist the comments.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionEnrico SusatyoView Question on Stackoverflow
Solution 1 - IosEnrico SusatyoView Answer on Stackoverflow
Solution 2 - IosVizllxView Answer on Stackoverflow