我試圖使用objc爲應用程序啓用圖像文檔類型。我有權訪問我需要寫入的plist
。只是把我的腦袋纏繞在一個小時以上,讓我感到沮喪的是,有多少個密鑰,字典,數組需要編碼。我不明白。在plist中創建多列鍵
如果我沒有錯,我需要在另一個NSMutableArray
的NSDictionary
中創建一個NSMutableArray
?
我使用的NSMutableDictionary寫入的plist如下:
NSMutableDictionary *data;
if ([fileManager fileExistsAtPath: path]) {
data = [[NSMutableDictionary alloc] initWithContentsOfFile: path];
} else {
//no plist
}
這是我需要添加到plist中:
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Images</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.image</string>
</array>
</dict>
</array>
有人能指出我在正確的方向?
你們是不是在陣列插入字典,然後在字典一個數組? –