Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8439057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:54:01+00:00 2026-06-10T07:54:01+00:00

I am new to iPhone, I am currently developing an iPhone app and would

  • 0

I am new to iPhone,

I am currently developing an iPhone app and would like to implement the ability to download file from the internet. I have created the UIWebView, but want to know the best way of capturing the files when they are linked to in the webview and then download them to a specified folder in the documents directory.

Here is my code snippet,

 - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{ 
    [self.fileData setLength:0];
}

 - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data1
 {
       [self.fileData appendData:data1]; 
 }

 - (void)connectionDidFinishLoading:(NSURLConnection *)connection
 {
     [activityIndicator stopAnimating];
     activityIndicator.hidden=TRUE;
}

- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {

    url = [request URL];

    //CAPTURE USER LINK-CLICK.
    NSString *file = [NSString stringWithString:[url absoluteString]];;
    NSURL *fileURL = [NSURL URLWithString:file];
    NSURLRequest *req = [NSURLRequest requestWithURL:fileURL];
    [NSURLConnection connectionWithRequest:req delegate:self];
     data = [NSData dataWithContentsOfURL:url];

            //Saving file at downloaded path.

        DirPath = [DestPath stringByAppendingPathComponent:[url lastPathComponent]];
        [data writeToFile:DirPath atomically:YES];

        UIAlertView* Alert = [[UIAlertView alloc] initWithTitle:@"Download Complete !"
                                                                             message:nil delegate:nil 
                                                                   cancelButtonTitle:@"OK"
                                                                   otherButtonTitles:nil];
                        [Alert show];
                        [Alert release];



    return YES;   
}

Problem is where to write condition, if my downloading gets failed and also i am getting Warning in my log shows : “wait_fences: failed to receive reply: 10004003”

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:54:03+00:00Added an answer on June 10, 2026 at 7:54 am

    It seems like you’re doing the same thing multiple times in this code. For example, you create a new NSURLRequest object even though one was already passed inside of the delegate method? You also run the synchronous dataWithContentsOfURL method after creating a new NSURLConnection? You also append some data into a property only to do nothing with that property?

    What you probably want to do is create a new asynchronous NSURLConnection when the UIWebView should load. From there, allow the UIWebView to load that page. Inside of your delegate methods, instead of appending the data to some property, append the downloaded data to a file. When the connection finishes downloading, present your alert informing the user that the data was downloaded and saved.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently working on a concept for a new iPhone app, the would involve
I am new to iPhone, I am currently developing an iPhone app and in
I have a new iPhone app that has the following (and only the following)
I would like to implement offline reading for a news application I have been
I am very new to iOS development. I am developing an app, currently i
I am new to iphone development. I am currently doing a restaurant app which
I am currently writing my first iPhone app, but have encountered an issue. I
I am currently developing an iPhone application which loads data from an RSS feed
My iPhone app currently uses Core Data to save Growth Entries created by the
I have just finished developing an iPhone app and now I wish to make

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.