2011-10-18 2 views

답변

0

[[NSUserDefaults standardUserDefaults]의 setObject : yourString forKey : yourKey] // SET

yourString = [[NSUserDefaults standardUserDefaults] objectForKey : yourKey]; //

0

U는 PLIST 파일을 작성해야합니다 GET .plist

1 단계 : #DEFINE의 DataFilePath 전에 @implementation

#define DataFilePath    [@"~/Documents/<fileName>.plist" stringByStandardizingPath] 

2 단계 : 이상의 PLIST 파일을 만들

if (! [[NSFileManager defaultManager] fileExistsAtPath : DataFilePath]) {NSData * data = [[NSD ata alloc] initWithContentsOfFile : [[NSBundle mainBundle] pathForResource : @ ""ofType : @ "plist"]]]; [data writeToFile : DataFilePath atomically : TRUE]; [데이터 공개]; } NSData * data = [NSData dataWithContentsOfFile : DataFilePath]; NSLog (@ "% @", DataFilePath);
NSPropertyListFormat 형식; NSArray * 배열 = [NSPropertyListSerialization propertyListFromData : 데이터 mutabilityOption : NSPropertyListImmutable 형식 : & 형식 errorDescription : nil];

3 단계 : PLIST 파일에 저장

경로는 NSString * = [CommonFunctions documentsDirectory] stringByAppendingFormat @ "/ %의 @"]; NSLog (@ "파일 경로 = % @", 경로); [데이터 writeToFile : 원자 적으로 경로 : TRUE];

관련 문제