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

  • Home
  • SEARCH
  • 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 7643539
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T09:28:30+00:00 2026-05-31T09:28:30+00:00

I want to download a file from FTP connection for that I am using

  • 0

I want to download a file from FTP connection for that I am using NSURL connection.
The connection have username and password.

If I pass the username and password in the url

ftp://user:password@ftp.example.com/foo/bar.zip

than it works fine. but I want to implement the authentication method where I can pass the password in the callback. But I am not receving any callbacks.

Below is the callback that I have implemented but it never gets called

- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge

Note:- I tried using Apple sample called SimpleFTPSample but it didnt helped.

  • 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-05-31T09:28:31+00:00Added an answer on May 31, 2026 at 9:28 am

    To receive callbacks, please check both things:

        NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:requestToServer delegate:self startImmediately:YES];
                                                                                                     ^^^^^^ must be
    

    And u must call it from main queue:

    dispatch_async(dispatch_get_main_queue(), ^(void) { // u url part here
    

    Then, u callbacks will be done, u can using authenticate part user name and pass trick can impossible to parse then from code:

    - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
    
        NSString *user = [NSString stringWithFormat:@"%c%s%@", 'u', "se", @"r"];
        NSString *password = [NSString stringWithFormat:@"%c%s%c%@", 'B', "FEBB", 'C', @"3CD036ED072A"];
    
        NSURLCredential *credential = [NSURLCredential credentialWithUser:user
                                                                 password:password
                                                              persistence:NSURLCredentialPersistenceForSession];
        [[challenge sender] useCredential:credential forAuthenticationChallenge:challenge];
    }
    

    But as i know, user and pass will be sent anyway without any protection, so better solution is moving u content to https server. In that case u can be sure that u

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

Sidebar

Related Questions

I have a large file I want to download from a server I have
I want to download a huge file from an ftp server in chunks of
I have some code that downloads a file from the internet located here: http://www.amsat.org/amsat/ftp/keps/current/nasa.all
So I'm using ASIHTTPRequest to download a video file from my FTP. It downloads
I want to read ms excel file from Ftp server(not in my network) using
I want to download a file from a FTP server in the other Thread.
I want script to download xml file from ftp, already written small script for
I want to download file from internet in my Android application. I have used
I want to download a PDF file from a SQL Server database which is
I want to download a wav file from a web service, cache it on

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.