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 6600783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T18:40:09+00:00 2026-05-25T18:40:09+00:00

My NSURLConnection delegates aren’t getting called. I’m trying to do this instead of using

  • 0

My NSURLConnection delegates aren’t getting called. I’m trying to do this instead of using this [NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSURL URLWithString: urlAddress] host]]; this isn’t allowed for the appstore.

NSUserDefaults *defaults =[NSUserDefaults standardUserDefaults];
myError.hidden = FALSE;
NSHTTPURLResponse   * response;
NSError             * error;
NSMutableURLRequest * request;
NSString            * params;
NSString *urlAddress = [NSString stringWithFormat:@"%@/?action=request&api=json&module=ManagementModule&function=startSession&instance=0",[ConnectServer returnserverip]];
NSLog(@"UPX %@",[ConnectServer returnserverip]);
NSLog(@"IP %@",[ConnectServer returnclientip]);
if([defaults boolForKey:@"enablePincode"]){
    NSString *account = [defaults stringForKey:@"myAccount"];
    NSString *username =[defaults stringForKey:@"myUsername"];
    NSString *password = [defaults stringForKey:@"myPassword"];
    NSString *clientip = [ConnectServer returnclientip];
    NSString *clientname = [ConnectServer returnclientname];
    params = [[[NSString alloc] initWithFormat:@"params=&auth[password]=%@&auth[mode]=%@&auth[account]=%@&auth[user]=%@&auth[rights]=%@&auth[user_ip]=%@&auth[client_name]=%@",password,@"password",account,username,@"user",clientip,clientname] autorelease];

request = [[[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:urlAddress] cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60] autorelease];
NSData *myRequestData = [params dataUsingEncoding:NSUTF8StringEncoding];
//[NSURLRequest setAllowsAnyHTTPSCertificate:YES forHost:[[NSURL URLWithString: urlAddress] host]];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:myRequestData];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setValue:[NSString stringWithFormat:@"%d", [myRequestData length]] forHTTPHeaderField:@"Content-Length"];
request.URL = [NSURL URLWithString:urlAddress];
error       = nil;
response    = nil;
NSData * data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&error];
>>>>>>NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request delegate:self ];
>>>>>>[connection start];
NSLog(@"The server saw:\n%@", [[[NSString alloc] initWithData:data encoding: NSASCIIStringEncoding] autorelease]);
NSLog(@"Parameters: %@", params);
NSLog(@"Actual sended parameters to the server: %@", myRequestData);
NSString *Sresponse;
  • 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-25T18:40:09+00:00Added an answer on May 25, 2026 at 6:40 pm

    1- make sure that you make delegate self and i think that you doing it.
    2-also make sure that you are do not using another thread like NSOperationINvocation..
    3- when execute the above code make sure you can try

    [self performselectoratmainthread:@selecor(function:)withObject:Object];

    NSString *ips = [NSString stringWithFormat:@"http://10.0.0.0:2552/NewsAccessService.asmx"];
        NSString *soapMessage = [NSString stringWithFormat:
                                 @"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
                                 "<SOAP-ENV:Envelope \n"
                                 "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" \n"
                                 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" 
                                 "xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
                                 "SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\" \n"
                                 "xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"> \n"
                                 "<SOAP-ENV:Body> \n"
                                 "<GetAlbumPhotos xmlns=\"http://tempuri.org/\"/> \n"
                                 "</SOAP-ENV:Body> \n"
                                 "</SOAP-ENV:Envelope>"];
        NSURL *url = [NSURL URLWithString:ips];
        NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];                         
        NSString *msgLength = [NSString stringWithFormat:@"%d", [soapMessage length]];              
        [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
        [theRequest addValue: @"http://tempuri.org/GetAlbumPhotos" forHTTPHeaderField:@"Soapaction"];
        [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
        [theRequest setHTTPMethod:@"POST"];     
        [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
        NSURLConnection *theConnection = [[[NSURLConnection alloc] initWithRequest:theRequest delegate:self] autorelease];
        if(theConnection) {
            webData = [[NSMutableData data] retain];
            AlbumPhotos = [[NSMutableArray alloc] init];
            x = 1;
            return x;
        }
    

    to handle delegates such

    - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
        [webData setLength:0];
    }
    
    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
        [webData appendData:data];
    }
    
    - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
        //NSLog(@"Connection failed: %@", [error description]);
    
    }
    
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
        [connection release];
        NSString *responseString = [[NSString alloc] initWithData:webData encoding:NSUTF8StringEncoding];
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using CLLocationManager on device and the delegate methods aren't getting called. Here's
I am using this code: NSURLConnection *oConnection=[[NSURLConnection alloc] initWithRequest:oRequest delegate:self]; to download a file,
Riddle me this: I am using a NSURLConnection on an iPhone Simulator SDK 3.1.2
I am using NSURLConnection to send request to server and receive response like this
I am using this NSURLConnection Delegate method - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response { long
NSURLConnection delegate method is not called (didReceiveResponse,connectionDidFinishLoading etc) .when i am using a same
I have been following the documentation for using NSURLConnection and am using delegates for
There's a delegate in NSURLConnection - (void)connectionDidFinishLoading:(NSURLConnection *)connection This will be called when the
I've created a text field using storyboard and am trying to setup the delegates.
I am trying to create a simple NSURLConnection to communicate with a server using

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.