HI 可以向我發送示例代碼以將數據添加到.plist中。 。我的plist在這個格式follows.kindly幫我出如何將數據寫入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">
<array>
<string>http://localhost:8888/sample</string>
<string>http://localhost:8888/sample</string>
</array>
</plist>
我西港島線從實現發送URL字符串code.kindly幫我在這PLS ..
-(IBAction)AddFieldid)sender;
{
NSMutableArray *myPrimaryinfo = [[NSMutableArray arrayWithCapacity:6]retain];
NSArray *keys = [NSArray arrayWithObjects:@"string",nil];
[myPrimaryinfo addObject:[NSDictionary dictionaryWithObjects:[NSArray arrayWithObjects:
[NSString stringWithFormat:@"sample"],nil]forKeys:keys]];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDire ctory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *path = [documentsDirectory stringByAppendingPathComponent:@"urls.plist"];
[myPrimaryinfo writeToFile:path atomically:NO];
NSLog(@"PrimaryInfo array: %@", myPrimaryinfo);
}
感謝
爲了鼓勵人們不斷回答您未來的問題,您應該嘗試接受以前問題的答案。 – 2010-07-12 09:11:30
嗨克勞斯 我想你已經看到了我的代碼。你可以指導我做出錯誤。 謝謝.. – siva 2010-07-21 06:43:08