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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:06:56+00:00 2026-05-16T05:06:56+00:00

I have used below code in my application of User Registration to interact with

  • 0

I have used below code in my application of User Registration to interact with remote database.

-(IBAction)checkFirstName:(UITextField*)textField   
{

    NSURL  *url = [NSURL URLWithString:@"http://mysite.com"];

     ASIFormDataRequest  *request = [ASIFormDataRequest  requestWithURL:url];
     [request setPostValue: firstName.text  forKey:@"firstName"]; 

     [request  setDelegate:self];
     [request  didReceiveDataSelector];
     [request  startAsynchronous];

      firstName.rightViewMode = UITextFieldViewModeAlways;
       if (receivedData==0)
      { 
        UIImage  *image = [UIImage imageNamed:@"close.png"];
        [button  setImage:image  forState:UIControlStateNormal];
        firstName.rightView = button;
      }
}

‘firstName’ is the textfield value which i used to take input from user.
I used the below method to receive response from database

 -(void)request:(ASIHTTPRequest *)request  didReceiveData:(NSData *)data

    {
      receivedData = [request responseData];
     [receivedData  appendData:data];

     receivedString = [[NSString alloc]  initWithData:receivedData
               encoding:NSUTF8StringEncoding];
    }

‘receivedData’ is the NSData object, declared globally. I have to get the ‘responseData’ as either 0 or 1, which will be stored in a variable ‘receivedData’.

  1. How to check the value of ‘receivedData’ object (0 or 1)?.
  2. checkFirstName: action will be fired on uitextfield Editing DidEnd event.

Can we use responseData==0 ? Please, suggest me with a solution…
Waiting for an urgent response..

  • 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-16T05:06:57+00:00Added an answer on May 16, 2026 at 5:06 am

    First, you are going to need to rethink the way your methods work.

    1. [request didReceiveDataSelector]; returns the method name that is called when the request receives data. Since you are not setting this value to a variable, this line does nothing.
    2. if (receivedData==0) won’t do what you want it to do. The request runs asynchronously, so the value of receivedData will not ever reflect what happens in the request you started 2 lines previously.
    3. Are you trying to check if receivedData is null? If so, say this: if (receivedData == nil), it makes it clear what you’re trying to do here.
    4. In your request:didReceiveData method it looks like you are getting the data from the request and appending it onto itself (I’m not sure what the responseData property looks like when you access it before the request is finished. It could be null). Whatever is happening here, I’m pretty sure it’s not what you wanted to happen.

    Finally, unless you really want to aggregate and parse the incoming data yourself (you probably don’t) you should impliment these two methods instead of the request:didReceiveData method.

    - (void)requestFinished:(ASIHTTPRequest *)request;
    - (void)requestFailed:(ASIHTTPRequest *)request;
    

    They’re called after the request is completely done. Access a string value for the server response by calling

    NSString *receivedString = [request responseString];
    

    Only after your requestFinished method is called can you set the value of your first name UITextField.

    And one bit of advice: it’s rare that you need to use global variables in Obj-C and you certainly do not need to use them here. I’d get rid of those ASAP.

    I made a lot of assumptions about what your intent was, so leave a comment if this isn’t what you wanted. Good luck!

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

Sidebar

Related Questions

I have used traditional version control systems to maintain source code repositories on past
I have used IPC in Win32 code a while ago - critical sections, events,
Please help! I am new to the .NET web application development. I have used
Basically I have a WPF application that will display announcements to the user within
Below is part of a PHP database class someone else wrote, I have removed
Below is my code present in my application : <input id=input value=Testing /> <a
I have used oracle connection like below. using (OracleConnection connection = OracleHelper.GetConnection(this.ConnectionStringKey)) { //some
I have used the XML Parser before, and even though it worked OK, I
I have used Photoshop CS2's Save for Web feature to create a table of
I have used this in my HTML: <q> Hai How r u </q> Which

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.