Как записать XML-данных в Plist файл в iPhone? - PullRequest
1 голос
/ 12 августа 2011

как записать данные XML в файл plist в iphone? я использую этот код `Я использую этот код
- (void) connectionDidFinishLoading: (NSURLConnection *) соединение {

NSString *thexml=[[NSString alloc] initWithBytes:[webdata mutableBytes] length:[webdata length] encoding:NSASCIIStringEncoding];
  NSArray *paths = NSSearchPathForDirectoriesInDomains

(NSDocumentDirectory, NSUserDomainMask, YES);


NSString *documentsDirectory = [paths objectAtIndex:0];

//make a file name to write the data to using the documents directory:

// NSString * path = [[NSBundle mainBundle] pathForResource: @ "mySettings" ofType: @ "plist"]; NSString * fileName = [NSString stringWithFormat: @ "% @ / textfile.plist",

                      documentsDirectory];

//create content - four lines of text

//NSString *content = @"One\nTwo\nThree\nFour\nFive";
NSString *content =thexml;
NSLog(@"%@",thexml);
//save content to the documents directory

[content writeToFile:fileName 

          atomically:YES 

            encoding:NSStringEncodingConversionAllowLossy 

               error:nil];

[self writePlist: 1 fileName: thexml]; [релиз xxml]; [освобождение соединения]; `

но я вижу, что plist-файл, который отображает файл, является curuupted. ?? Пожалуйста, дайте мне решение .... заранее спасибо

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...