0
사전 배열이 포함 된 plist에 쓰려고합니다. 각 사전에는 해당 사전 (룸)의 속성을 정의하는 문자열이 들어 있습니다. 나는 하나의 String에만 쓰려고하고, 그 속성을 if 문의 결과에 기반하여 무언가로 설정하려고한다.사전 배열이 포함 된 plist에 쓰기
PLIST의 예 : 어떤 도움을 크게 감상 할 수
NSString* newPlistPath = nil;
NSFileManager* manager = [NSFileManager defaultManager];
if ((newPlistPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"Favourites/Favourites.plist"]))
{
if ([manager isWritableFileAtPath:plistPath])
{
NSMutableDictionary* infoDict = [NSMutableDictionary dictionaryWithContentsOfFile:plistPath];
NSLog(@"infoDict %@", infoDict);
NSLog(@"infoDict %@", [[infoDict objectForKey:@"Availability"] objectAtIndex:0]);
[infoDict setValue:@"available" forKey:@"Rooms.Availability"];
[infoDict writeToFile:newPlistPath atomically:NO];
[manager setAttributes:[NSDictionary dictionaryWithObject:[NSDate date] forKey:NSFileModificationDate] ofItemAtPath:[[NSBundle mainBundle] bundlePath] error:nil];
}
}
:
객실 여기에 = (
{
Availability = unavailable;
Floor = 1;
Name = "Ferret Room";
Status = Busy;
Time = "4.00pm";
},
{
Availability = unavailable;
Floor = 1;
Name = "Squirrel Room ";
Status = Busy;
Time = "4.00pm";
},
그리고 내 코드의 예입니다 비슷한 질문이 있지만 할 일에 대한 해결책이 없습니다. 감사합니다.
앱 번들에 쓸 수 없습니다. 읽기 전용입니다. – rmaddy