2015-03-31 59 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:])都會丟棄<!-- ... -->註釋。

讓他們堅持下去的唯一方法是讓數據的註釋部分被存儲。