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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:17:16+00:00 2026-06-11T13:17:16+00:00

In my app i am using ASIFormDataRequest to send my new user registration request

  • 0

In my app i am using ASIFormDataRequest to send my new user registration request . That request contains user details along with image that is converted using base64Encoding. I got the response also. but the application get crash after getting the response. please help me to fix this issue. is there any error is this code?

NSString *sx=@"male";
        registrationStatusBlock = response;
        NSDateFormatter *dateOfBirthFormatter = [[NSDateFormatter alloc] init];
        [dateOfBirthFormatter setDateFormat:@"YYYY:MM:dd"];
        [dateOfBirthFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"UTC"]];
        NSString *formattedDate = [dateOfBirthFormatter stringFromDate:userDetails.dateOfBirth];


        NSLog(@"URL: %@", [NSString stringWithFormat:@"%@&firstName=%@&lastName=%@&password=%@&emailId=%@&portrait=%@&dob=%@&gender=%@&task=createUser",webServiceURL,userDetails.firstName, userDetails.lastName, userDetails.emailAddress, userDetails.password, userDetails.profilePicture, formattedDate, sx]);
        NSLog(@"Gender %@",userDetails.gender);

        int lengthOfData=0;
        NSString *encodedString ;
        NSData *    imageData = UIImagePNGRepresentation(userDetails.profilePicture);

        registrationStatusBlock = response;
        self.responseData = [NSMutableData data];
        if(userDetails.profilePicture !=NULL)
        {
            lengthOfData = imageData.length;
            encodedString =  [NSString base64StringFromData:(NSData *) imageData length:lengthOfData];
        } 
        else
            encodedString=@"";

        NSLog(@"URL: %@", [NSString stringWithFormat:@"%@&firstName=%@&lastName=%@&password=%@&emailId=%@&portrait=%@&portrait_type=png&dob=%@&gender=%@&task=createUser",webServiceURL,userDetails.firstName, userDetails.lastName, userDetails.emailAddress, userDetails.password, encodedString, formattedDate, sx]);



        NSMutableString *URLString = [[NSMutableString alloc]initWithString:webServiceURL];
        [URLString appendString:[NSString stringWithFormat:@"%@&firstName=%@&lastName=%@&password=%@&emailId=%@&portrait=%@&portrait_type=png&dob=%@&gender=%@&task=createUser",webServiceURL,userDetails.firstName, userDetails.lastName, userDetails.emailAddress, userDetails.password, encodedString, formattedDate, sx]];

        ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:[NSURL URLWithString:[webServiceURL stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]];

        [request addPostValue:userDetails.firstName       forKey:@"firstName"];
        [request addPostValue:userDetails.lastName        forKey:@"lastName"];
        [request addPostValue:userDetails.password        forKey:@"password"];
        [request addPostValue:userDetails.emailAddress    forKey:@"emailId"];
        [request addPostValue:encodedString forKey:@"portrait"];
        [request addPostValue:@"png" forKey:@"portrait_type"];

        [request addPostValue:formattedDate forKey:@"dob"];

        [request addPostValue:sx forKey:@"gender"];

        [request addPostValue:@"createUser"                   forKey:@"task"];
        [request setRequestMethod:@"POST"];
        NSLog(@" user registration request %@",request);
        [request setDelegate:self];
        [request startAsynchronous];
        [NSThread sleepForTimeInterval:5];
        NSLog(@"response %@",[request responseString]);
        registrationStatusBlock =[[request responseString]JSONValue]; 
  • 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-11T13:17:17+00:00Added an answer on June 11, 2026 at 1:17 pm

    Use the delegate to get the response string.

    [request setDelegate:self];
    [request setDidFinishSelector:@selector(requestFinished:)];
    [request setDidFailSelector:@selector(requestFailed:)];
    [request startAsynchronous];
    

    Then capture the response from the delegate:

    - (void)requestFinished:(ASIHTTPRequest *)theRequest {
         NSLog(@"response %@",[theRequest responseString]);
    }
    
    - (void)requestFailed:(ASIHTTPRequest *)theRequest {
         NSLog(@"response Failed%@, Error:%@",[theRequest responseString],[theRequest error]);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm doing an app which retrieves user info, and it does that using a
I'm developing an app using Silverlight control for Bing Maps . User can search
Basically I am trying to upload an image using ASIFormDataRequest. This is my following
I'm building an app using Brunch and Backbone.js that is to include nested menus.
I'm building an app using someone else's API allowing the user to browse content
We are building an app using the MVVM pattern, we have controllers that wire
I'm developing metro app using C# and XAML, I'm stuck with grid view that
My web app using JMS to send mail via GMAIL as my SMTP server.
I have an app using a UITabBarController, and I have another view that needs
im my app i am using ASIFormDataRequest class but it seems they are not

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.