Hi, In my app I 'm first connecting to a web service, which in return sends a url for a file. I use the url to download the file and then display it on the new view.
I get the correct URL but not able to download file from that location. I have another test app which will download file from the same location and it works like a charm.
following is my code for webservice-file download. This is a snippet of the code where i 'm parsing the web service xml and then pass the result to NSData for file download.
Any suggestions where am i going wrong ??
I 'm referring to the following tutorials.
thxs
if ([elementName isEqualToString:@"PRHPdfResultsResult"])
{
NSLog(soapResults);
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:@"Report downloaded from:"
message:soapResults
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
NSData *pdfData = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:soapResults]];
//Store the Data locally as PDF File
NSString *resourceDocPath = [[NSString alloc] initWithString:[[[[NSBundle mainBundle] resourcePath] stringByDeletingLastPathComponent] stringByAppendingPathComponent:@"Documents"]];
NSString *filePath = [resourceDocPath stringByAppendingPathComponent:@"myPDF.pdf"];
[pdfData writeToFile:filePath atomically:YES];
[alert show];
[alert release];
[soapResults setString:@""];
elementFound = FALSE;
}