plist에 일부 설정이 있지만 앱을 죽이면 거기에 저장된 모든 데이터가 손실됩니다.plist의 내 정보가 저장되지 않습니다.
가 .H
@property (retain, nonatomic) NSString *plistFilePath;
-(IBAction)setHomepage:(id)sender;
.m
@syntehzise plistFilePath;
-(IBAction)setHomepage:(id)sender{
plistFilePath = [NSString stringWithString:[[NSBundle mainBundle] pathForResource:@"settings" ofType:@"plist"]];
NSMutableDictionary *data= [[NSMutableDictionary alloc] initWithContentsOfFile:plistFilePath];
[data setObject:@"http://www.google.com" forKey:@"Homepage"];
[data writeToFile:plistFilePath atomically:YES];
[data release];
}
내가 뭔가 잘못하고 있는가 :
이것은 내가 사용하고 코드는? 다른 클래스 또는 differents 메소드를 사용해야합니까? 내가 정보를 잘 저장하는 이유를 알지 못하기 때문에 나를 도와주세요.하지만 앱을 죽일 때 잃어 버립니다.
당신의 대답은 좋습니다! 한 가지 더; appDelegate.m에서 코드의 첫 번째 블록을 작성해야합니까? – adr
개인적으로'applicationDidFinishLaunching'이 좋다고 생각합니다 :) –