Iphone 串铸
我用字典手动编写了一个.plist文件。 我的问题是返回的密钥“route_id”的值是错误的。 我用“1”代替“01” 这是我的格言: <dict> <key>route_desc</key> <integer>1</integer> <key>route_id</key> <string>01</string> </dict> 路线描述 1. 路线号 01 这是我的代码: NSLog(@"%@", [selectedRoute valueForKey:@"route_id"]); NSLog(@“%@,[selectedRoute valueForKey:@“route_id]”); 返回1而不是01Iphone 串铸,iphone,casting,nsdictionary,Iphone,Casting,Nsdictionary,我用字典手动编写了一个.plist文件。 我的问题是返回的密钥“route_id”的值是错误的。 我用“1”代替“01” 这是我的格言: <dict> <key>route_desc</key> <integer>1</integer> <key>route_id</key> <string>01</string> </dict> 路线描述 1. 路线号 01 这是我的代码: NSLog(@"%@", [selectedRoute va
如果有人能帮我得到正确的价值 我不知道你在做什么,但你把事情搞砸了。我将plist保存到桌面并运行:
NSDictionary * d = [NSDictionary dictionaryWithContentsOfFile:@"/Users/dave/Desktop/test"];
NSLog(@"%@", d);
NSLog(@"%@", [d valueForKey:@"route_id"]);
NSLog(@"%@", [d objectForKey:@"route_id"]);
得到:
2011-01-10 14:35:55.437 EmptyFoundation[15631:a0f] {
"route_desc" = 1;
"route_id" = 01;
}
2011-01-10 14:35:55.440 EmptyFoundation[15631:a0f] 01
2011-01-10 14:35:55.440 EmptyFoundation[15631:a0f] 01