Tag: plist

Localizable.strings导致plistparsing错误

我刚刚在我的Xcode项目中本地化了Localizable.strings文件,以便将我的应用程序本地化为几种不同的语言。 但是,使用标准的“key = value”格式编辑每个文件后,我收到下面的parsing错误,它没有指定一个文件,很难追踪它所指的内容。 CFPropertyListCreateFromXMLData():旧样式的plistparsing器:在第10行的字典中缺less分号。parsing将被废弃。 打破_CFPropertyListMissingSemicolon进行debugging。 我查看了每个* .strings文件,特别是第10行,并且我没有发现什么引起问题的兴趣或问题。 请你能告诉我哪里出错了。 这里是我的项目中的一个Localizable.strings文件的示例。 所有其他文件遵循相同的格式。 "Enter URL" = "Voer adres in" "Headers" = "Koppen" "Key" = "sleutel" "Value" = "waarde" "Parameters" = "Parameters" "Tap to add a new line" = "Tik om een nieuwe lijn toe te voegen" "Perform request" = "Verzoek Uitvoeren" "Response" = "Antwoord" "Received Headers" = […]

NSNumber vs Int

如果整数不能写入字典,然后到.plist,但NSNumbers可以更好地使用NSNumbers整个应用程序,而不是需要转换每次保存或从.plist中加载字典?

如何在Xcode 4中将plist的根对象types更改为NSArray

如何将根对象types更改为在Xcode 4中创build的plist中的NSArray? 它默认为一种NSDictionary,但我找不到一种方法来改变它。

Plist数组NSArray没有对象

所以我search了,之前已经成功地读过了,但是却遇到了这个问题。 我有一个plist,是一串string。 我没有得到任何对象被读入数组。 我成功地做了这个在另一个控制器的字典。 所以这里是我的代码。 // Open plist and get brands NSString *plistPath = [[NSBundle mainBundle] pathForResource:@"brands" ofType:@"plist"]; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:plistPath]) { NSLog(@"The file exists"); } else { NSLog(@"The file does not exist"); } _brands = [NSArray arrayWithContentsOfFile:plistPath]; _catList = [[[NSMutableArray alloc] initWithCapacity:[_brands count]] autorelease]; 这是我的plist。 请注意_brands数组被定义为NSArray *品牌,属性设置为非primefaces,只读,并被合成为品牌= _brands。 <?xml […]

字典和数组有什么区别?

字典和数组之间有什么区别,特别是在使用PLIST文件时? 使用其中一个的优点是什么? 谢谢!

如何在iphone中以编程方式创buildPLIST文件

我正在寻找创buildplist文件在我的应用程序的文件夹编程方式在客观C.我在文件目录中创build一个文件夹: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectoryPath = [paths objectAtIndex:0]; NSString *path = [NSString stringWithFormat:@"%@/Data.plist", documentsDirectoryPath]; 我正在尝试创build一个看起来像XML文件的plist文件。 / ****必需的XML文件**** / <?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"> <array> <dict> <key>height</key> <integer>4007</integer> <key>name</key> <string>map</string> <key>width</key> <integer>6008</integer> </dict> </array> </plist> / ****通过代码实现文件**** / <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD […]

修改一个plist不起作用

我必须在我的plist文件修改一个布尔值存储与bundle.i能够访问字典,我必须修改。从nslogging我可以看到,字典更新了新的价值,但问题是当我检查在捆绑plist它没有被修改。许多线索为什么它不更新plist NSString* plistPath = nil; NSFileManager* manager = [NSFileManager defaultManager]; if (plistPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"TopicsList.plist"]) { if ([manager isWritableFileAtPath:plistPath]) { NSMutableArray* dictarrays = [NSMutableArray arrayWithContentsOfFile:plistPath]; NSMutableDictionary *dict=[dictarrays objectAtIndex:indexPath.row]; NSLog(@"%@ ",dict ); [dict setObject:[NSNumber numberWithBool:YES] forKey:@"isPaid"]; NSLog(@"%@ ",dict ); [dict writeToFile:plistPath atomically:NO]; NSLog(@"%@ ",dict ); [manager setAttributes:[NSDictionary dictionaryWithObject:[NSDate date] forKey:NSFileModificationDate] ofItemAtPath:[[NSBundle mainBundle] bundlePath] error:&error]; […]

如何在iOS上从磁盘加载plist文件作为NSDictionary?

我想从资源包中从磁盘(文档,应用程序caching,…)加载plist文件。

设置plist来存储iPhone游戏的应用程序数据(不是设置)

我正在写一个iPhone游戏,并与我的关卡数据硬编码很好地工作,但我想将水平数据存储在一个plist载入它启动。 我从来没有使用过plists,也没有理解如何根据我的数据模型设置plist。 下面是我现在如何硬编码: (在我的appDelegate) – (void)loadLevels { //setup NSNumber objects to load into sequences NSNumber * rID = [[[NSNumber alloc] initWithInt:0] autorelease]; NSNumber * bID = [[[NSNumber alloc] initWithInt:1] autorelease]; NSNumber * gID = [[[NSNumber alloc] initWithInt:2] autorelease]; NSNumber * yID = [[[NSNumber alloc] initWithInt:3] autorelease]; NSNumber * rbID = [[[NSNumber alloc] initWithInt:4] autorelease]; NSNumber […]

在Xcode中创build和编辑plist文件的步骤

我想在plist添encryption钥对值。 我不知道如何在XCode中添加.plist文件。 只需要在名为“ Mobile.plist ”的.plist文件中添加这些详细信息。 Apple – iPhone,iPod,iPad Samsung – Galaxy Y, Galaxy R, Galaxy Z Nokia – Lumina LG – Lg1 ,Lg2, Lg3 我已经尝试使用此链接创build一个新的Mobile.plist文件的步骤, http://iphoneincubator.com/blog/tutorial/how-to-create-an-iphone-preferences-file 。 但是,我不能确切地得到它。 当我尝试使用这个链接的步骤时,plist文件总是空的。 我不知道如何在plist中添加键值。 我创build了一个名为Settings and add new plist file named as Root.plist组, Settings and add new plist file named as Root.plist 。 你可以请提供步骤来创build.plist文件,并添加键值, 提前致谢。