Goal C - Writing NSString to plist

I write NSString to a plist file, but after writing it to plist, and when I try to open, I get the following message "This document" mylist.plist "cannot be opened XML parser error: Unexpected character 2 on line 1 Style parser error Old Style: Unexpected ';' or '=' after the key on line 1 "

Here is my code:

NSString *temp = [NSString stringWithFormat:@"%@\n Selection is %@ \n %d for %.2lf = %.2lf", [NSDate date], @"IPC", 2, 42.34, 2 * 42.34]; 
[temp writeToFile:[self getPathName:@"mylist.plist"] atomically:YES]; 

Any help would be appreciated.

Thank,

+3
source share
2 answers

-[NSString writeToFile...] . . , " plist". NSArray NSDictionary plist. NSString ( , NSDate NSData ..), , , .

.

: , " plist". , XML-, DTD Apple Plist: http://www.apple.com/DTDs/PropertyList-1.0.dtd

+3

%@\n Selection is %@ \n %d for %.2lf = %.2lf - plist. plist, +[NSPropertyListSerialization dataFromPropertyList:...] plist, .

plist, 1 . .txt +[NSString stringWithContentsOfFile:...].

0

Source: https://habr.com/ru/post/1732640/


All Articles