2012-03-09 4 views
2

저는 iOS 개발을 처음 사용 했으므로 iOS에서 파일을 작동하는 방법을 알고 싶습니다. .plist 어느 누구도 저에게 .plist 사이의 쓰기 데이터를 읽는 방법의 예를 제공하여 나를 도울 수 있습니까?.plist 파일은 iOS에서 어떻게 작동합니까?

+0

http://stackoverflow.com/questions/5853735/how-can-we-create- : 파일에 쓰기는

NSString *rootPath = [[NSBundle mainBundle] bundlePath]; NSString *pListPath = [rootPath stringByAppendingPathComponent:@"Settings.bundle/Root.plist"]; NSDictionary *pList = [NSDictionary dictionaryWithContentsOfFile:pListPath]; 

너무 열심히 하나 아니다 우리 자신의 plist-file-in-a-xcode 프로젝트 –

답변

7

그래 :

NSDictionary *dict; 
NSData *data = [NSPropertyListSerialization dataWithPropertyList:dict format:NSPropertyListXMLFormat_v1_0 options:0 error:&error]; 
[data writeToFile:self.saveToPath atomically:YES]; 
관련 문제