简体   繁体   中英

download XML file from server

hi guys,i parse my file xml from my server

NSString *theXML = [[NSString alloc] initWithBytes: [Conn.webData mutableBytes] length:[Conn.webData length] encoding:NSUTF8StringEncoding];
    //NSLog(theXML);
    [theXML release];

but now i want download this file in my iPhone,it possible to do this?

i see this exemple but i not undersund:

NSString *path=[NSTemporaryDirectory() stringByAppendingString:@"file.txt"];

// save the people array
BOOL saved=[NSKeyedArchiver archiveRootObject:people toFile:path];
if(saved){
    //NSLog(@"saved");
}else{
    //NSLog(@"Not saved");
};

// reload array
people=[NSKeyedUnarchiver unarchiveObjectWithFile:path];
if(newArray==nil)
{
    // create new array
    people=[[NSMutableArray alloc] init];
}else{
    // retener los datos
    [perople retain];
};

You can use NSData *data=[NSData dataWithContentsOfURL: options: error:] and [data writeToFile: options:1 error:]; for doing this.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM