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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T08:03:54+00:00 2026-05-30T08:03:54+00:00

I am trying to create a http body that I am going to pass

  • 0

I am trying to create a http body that I am going to pass in using NSURLRequest post.
I have my connection class all set up.

The thing is i have several methods that return NSStrings and UInt32’s and one construction method that I want to use to put all of these methods into one http body which will be of data type format.

However I’m not sure how to call these methods that return the correct data from my construction method to gather the data into one data object.

here is some code that I have (shortened so its a little clearer)

these methods are used to return the data needed

- (UInt32) addDataVer
{
    UInt32 dataVer = 0;

    return dataVer;

}

- (NSString *) addReg
{
    NSString *reg = [[NSString alloc] initWithString:@"abcd1"];

    return reg;
}

- (NSString *) addActiv
{
    NSString *activ = [[NSString alloc] initWithString:@"abcd2"];

    return activ;
}

from here I’m not sure what to do, or how to get the data. I have created a construction method, that I want to use to grab the data and then I want to use that data to build a NSData object where I put the returning data into it in order.

this is my construction class

- (void) constructRequest
{
  //what the heck do I call in here? lol   
}

the last thing I will have to do is figure out how to put the nsdata representation of each return value into the data object… if that makes sense…

any help would be appreciated.

UPDATE::

So I figured out how to get the return value into my construction method, by following the force!

- (void) constructRequest
{
    NSString *mystring = [[NSString alloc] initWithString:[self addReg]];

    NSLog(@"mystring %@", mystring);
}

however I am not sure how to do this with a returning UInt32, or how to convert this in to a NSData structure

  • 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-30T08:03:55+00:00Added an answer on May 30, 2026 at 8:03 am

    From Apple Docs on String formatting https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html#//apple_ref/doc/uid/TP40004265-SW1

    [NSString stringWithFormat:"my unsigned 32-bit int: %d", [self addDataVer]];

    from Apple Docs about NSString class

    To convert your entire string to data:

    [myNSString dataUsingEncoding:NSUTF8StringEncoding];

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

Sidebar

Related Questions

We are trying to create a web-service that we plan to pass a variable
I am trying to create a custom cursor using the following image: http://anuary.com/dev/hp/pad3/public/images/hand-cursor.png The
I'm trying to create an if statement in PHP that prevents a single post
I've been trying to create a PLSQL package that will post into SharePoint through
I'm trying to create a use-once HTTP server to handle a single callback and
I am trying to create some charts of data (eg http://www.amibroker.com/ ). Is there
I'm trying to create a layout similar to this: alt text http://img20.imageshack.us/img20/3533/stackn.png Here's the
I am trying to create two different sets of settings for datepicker( http://keith-wood.name/datepick.html )
I'm following this guide: http://www.math.umd.edu/~dcarrera/ruby/0.3/chp_01/programs.html and I'm trying to create my first ruby program.
I'm trying to find out how they were able to create this site. http://www.cpeople.ru

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.