I have a magazine application i want that it load file from server and store it in application when application starts first time only and then use that locally file to save time i am getting data which is located on server it takes alot time
NSURL*myurl=url;
myurl = [myurl stringByReplacingOccurrencesOfString:@"\n" withString:@""];
myurl = [myurl stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]];
NSURL*urlloaded= [[NSURL alloc]initWithString:myurl];
//NSURL*url= [[NSURL alloc]initWithString:@"http://localhost:8888/RowOne.xml"];
NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithContentsOfURL:urlloaded];
//Initialize the delegate.
RowTwoParser *parser = [[RowTwoParser alloc] initXMLParser];
//Set delegate
[xmlParser setDelegate:parser];
BOOL success = [xmlParser parse];
if(success)
NSLog(@"No Errors");
else
NSLog(@"Error Error Error!!!");
What you can do is:-
Suppose you have parsed your xml and stored data in array say ‘
dataArray‘Now you have to save your
dataArrayinNSUserDefaultsWhenever you have to use this data you can extract it like:-