plist

Swift: Reading a plist from MainBundle and writing directly to Documents fails

梦想的初衷 提交于 2019-12-18 09:47:58
问题 Take the following file, named Permissions.plist : <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>SomeKey</key> <false/> </dict> </plist> I'd like to read it in from my MainBundle , modify it, and write it out to my .Documents . However, even if I leave it unmodified , the write fails. The Swift syntax seems to have changed since this question, and the

Read binary plist into NSDictionary

醉酒当歌 提交于 2019-12-18 07:04:45
问题 Is there simple way to parse the binary plist file into the NSDictionary representation? I am searching something like that: NSString* strings = [NSString stringWithContentsOfURL: ... encoding: NSUnicodeStringEncoding error: ...]; NSMutableDictionary* pairs = (NSMutableDictionary*)[strings propertyListFromStringsFileFormat]; Using this code caused the exception while parsing the binary plist file. 回答1: Are you looking for [NSDictionary dictionaryWithContentsOfFile:] ? 回答2: Considering a file

How to parse .plist file in Java?

扶醉桌前 提交于 2019-12-18 06:56:38
问题 I am trying to parse a .plist file in Java but not understanding how. I used a DOM parser but it gives an error and is not able to read .plist file. This is my plist file: 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>All Samples</key> <array> <dict> <key>Message</key> <string>1) UIATarget </string> <key>Timestamp</key> <date>2011-07-06T19:40:09Z</date> <key>Type<

Localizable.strings causing plist parsing error

随声附和 提交于 2019-12-18 05:39:29
问题 I have just localized the file Localizable.strings in my Xcode project in order to localise my application to a few different languages. However, having edited each of the files in the standard "key = value" format, I receive the following parsing error, which does not specify a file making it hard to track down what it is referring to. CFPropertyListCreateFromXMLData(): Old-style plist parser: missing semicolon in dictionary on line 10. Parsing will be abandoned. Break on

plist or sqlite

时光怂恿深爱的人放手 提交于 2019-12-18 04:52:25
问题 I have to store a huge amount of data on IPhone then sort and search it as per requirement. Can anyone suggest to me which of SQLite or plist should I use? I was thinking of using SQLite. Which of plist and SQLite takes less processing time in searching and sorting? If some one has some reference guide then let me know. Regards 回答1: Plist and SQLite have different use cases. PList is a file format used to store a small amount of structural data (less than a few hundred kilobytes), typically a

How to write to plist successfully?

ε祈祈猫儿з 提交于 2019-12-17 22:59:31
问题 I am having trouble writing my file into the plist after going through many tutorials, other people's problems and attempting it for myself. I can read the plist with no problems but I cant update it. Below are my codes on how I am writing my data into the plist. Correct me if I made any mistake. NSString *path = [[NSBundle mainBundle] pathForResource:@"EventAddress" ofType:@"plist"]; NSMutableDictionary *myDictionary = [[NSMutableDictionary alloc] initWithContentsOfFile:path]; NSArray*

Securing xml plists in Cocoa / Objective C

孤街浪徒 提交于 2019-12-17 22:25:18
问题 I am writing an application which reads information from am xml plist in the bundle upon startup. The information in the plist has been compiled through many days of work and I would like to ensure that it cannot be extracted easily from the app bundle by another party after distribution. Is there any way to secure or encrypt xml plists that one includes within your app bundle? Any help would be greatly appreciated please. 回答1: There is no built-in encryption function in plist. Many people

Add Item to Finder Sidebar

天涯浪子 提交于 2019-12-17 19:45:46
问题 I would like to add a new item to the Finder sidebar. I found out that the Finder keeps the list of "places" in `~/Library/Preferences/com.apple.sidebarlists.plist. I was able to read the file using Carbon API and saw that each item had Name, icon and alias. Using a 3rd party application such as PlistEdit Pro I was able to update the alias. My question is how to update the alias using Carbon API. Was not able to find a way to create alias that will open in Finder. It seem that both Dropbox

How to create PLIST files programmatically in iphone

余生长醉 提交于 2019-12-17 18:21:16
问题 I was looking to create plist file in my application Documents folder programmatically in objective C. I create a folder in documents directory : NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *path = [NSString stringWithFormat:@"%@/Data.plist", documentsDirectoryPath]; I am trying to create plist file which will look like an XML file. /**** Required XML File ****/ <?xml

Command-line tool for converting PLIST to JSON?

别说谁变了你拦得住时间么 提交于 2019-12-17 17:28:18
问题 Is there a command line tool available for converting .plist files to JSON? If not, what would be the approach for creating one using Objective-C or C on a Mac? For instance, there is JSONKit, for Objective-C. How would one go about opening a .plist file, pass it to JSONKit, and serialize that as JSON? 回答1: If you are on a Mac you can use the plutil tool on the command line (this comes with the developer tools I believe): plutil -convert json Data.plist as mentioned in the comments, this will