开发者

download XML file from server

开发者 https://www.devze.com 2023-03-18 09:14 出处:网络
hi guys,i parse my file xml from my server NSString *theXML = [[NSString alloc] initWithBytes: [Conn.webData mutableBytes] length:[Conn.webData length] encoding:NSUTF8StringEncoding];

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");
};

// r开发者_如何学JAVAeload 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消