2012-05-31 2 views
0

안녕하세요, NSDictionary를 문서 폴더의 plist에 쓰려고하는데 쓰기가 불가능합니다. writeToFile : atomically : 메서드를 사용하면 False를 반환합니다. 전체 코드는plist에 NSDictionary 쓰기

-(void)writeData:(NSDictionary *)dicResponseData 
{ 
    // get paths from root directory 

    NSArray *paths = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES); 
    // get documents path 
    NSString *documentsPath = [paths objectAtIndex:0]; 
    // get the path to our Data/plist file 
    NSString *plistPath = [documentsPath stringByAppendingPathComponent:@"Contractors.plist"]; 

    [dicResponseData writeToFile:plistPath atomically: TRUE]; 
} 

사전에 25 개의 하위 사전이 포함되어 있습니다.

+3

귀하의 동의율은 어떻습니까? – Till

+2

답변을 수락하지 않으므로 누구도 기꺼이 도와 줄 수 없습니다. – skram

+1

@skram 지금은 답변을 받아 들일 것입니다. 지금까지는 프로세스를 알지 못했습니다. – Singh

답변

1

사전의 모든 개체는 속성 목록 개체 여야합니다.

This method recursively validates that all the contained objects are property list objects (instances of NSData, NSDate, NSNumber, NSString, NSArray, or NSDictionary) before writing out the file, and returns NO if all the objects are not property list objects, since the resultant file would not be a valid property list.