2015-03-31 71 views
1

我想将所有apis保存为plist文件。绝对是一个关键值对。关键是像1001这样的数字,值是api路径字符串。我需要的是为其他开发者感到易于阅读的每个api对添加注释。我知道<!-- comments -->样式注释可以在plist源文件中完成,但是您知道我想让注释出现在plist文件(而不是文件源代码)中,看起来像在Xcode中打开的样子。请参阅:评论在plist文件

enter image description here

是可能的?

回答

0

创建API对象为字典并添加一个可读的注释对象!

0

您可以更改plist文件的结构。例如:

<?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 version="1.0"> 
<dict> 
    <key>content</key> 
    <array> 
     <dict> 
      <key>coment</key> 
      <string>the things you want to say</string> 
      <key>2001</key> 
      <string>image/%@</string> 
     </dict> 
     <dict> 
      <key>comment</key> 
      <string>the things you want to say</string> 
      <key>1001</key> 
      <string>image////</string> 
     </dict> 
    </array> 
    <key>comment</key> 
    <string>your comment</string> 
</dict> 
</plist> 

对不起,我无法上传图片。

0

您可以交互方式添加(和编辑)评论(使用Comment或任何你想要的关键字)与/Developer/Applications/Utilities/DevTools/Application//Utilities下保存苹果Property List Editor的帮助现有的plist文件。

1

这是不可能的,因为任何读取XML的代码(如[NSDictionary dictionaryWithContentsOfFile:])都会丢弃<!-- ... -->注释。

让他们坚持下去的唯一方法是让数据的注释部分被存储。