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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:19:50+00:00 2026-06-15T21:19:50+00:00

Here, I tried to send Asynchronous call to python server using SBJson framework .

  • 0

Here, I tried to send Asynchronous call to python server using SBJson framework. For continuous multiple call with same request, gives null value in response string.

here, what I tried :

- (NSURLConnection *) GetHttpConnection:(NSString *)Path:(NSDictionary *)requestData:(UIView *)appView {
    NSString *jsonReq = nil;
    NSData *reqData = nil;

    if (requestData != nil) {
        jsonReq = [requestData JSONRepresentation];
        reqData=[NSData dataWithBytes:[jsonReq UTF8String] length:[jsonReq length]];
    }
    NSString *urlString = [NSString stringWithFormat:@"%@/%@", URL, Path];
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:urlString]];
    [request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
    [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    if (reqData) {
        [request setHTTPBody:reqData];
    }
    [request setHTTPMethod:@"POST"];
    NSURLConnection *connection = [[NSURLConnection alloc]initWithRequest:request delegate:self];
    if (connection) {
        responseData = [[NSMutableData data] retain];
    }
    return connection;
 }

- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
    [connection release];
    NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
    NSLog(@"Connection Finish Loading >>>>> %@",responseString);    
    responseData = nil;
    if (responseString && [responseString JSONValue] != nil) {
       // process response string and send response back to delegate method
    }
  }


- (void)connection:(NSURLConnection *)connection didReceiveData:(NSMutableData*)data {
    [responseData appendData:data];
}

After tracing NSlog responses, I found this,
If I send same request 3 times (by pressing Update detail button)
connectionDidFinishLoading should call 3 times and it is calling it. but for any (one) request the respective response data returns null. Thats why the JSON stated below

JSONValue failed. Error trace is: (
“Error Domain=org.brautaset.JSON.ErrorDomain Code=11 \”Unexpected end of string\” UserInfo=0x909d4b0 {NSLocalizedDescription=Unexpected
end of string}”

How can I overcome from this scenario? or Is there anything wrong in the code?

Thanks!

  • 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-15T21:19:51+00:00Added an answer on June 15, 2026 at 9:19 pm

    Your class is not re-entrant as there’s only one reference to responseData. If two requests run at the same time Bad Things Will Happen. For this to work you’ll need to either put your requestData in a dictionary keyed by the NSURLConnection, or create another instance of your downloader for each request.

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

Sidebar

Related Questions

I am using GCD to send HTTP request asynchronously. Here is the code that
I tried to send email from c# using SmtpClient.Send() but it always goes to
I tried to send simple newsletter using oscommerce platform and the content is simple
I tried to connect to the server and send some information to the server(like
I tried the following code to send request to jsp page on a click
As advised I have tried using PHP Mailer to send email attachments with a
I tried to send mail using the email class of CodeIgniter, but it is
I'm using twitter sharing via TWTweetComposeViewController in my app. When i tried to send
I'm using JSONKit.h, JSONKit.m, ios5.1. and I tried to send data using GET method
Has anyone here tried to use a custom animation with MBProgressHUD. There is a

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.