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

I have been trying to create an XML using the simplexml library (v2.6.2) http://simple.sourceforge.net/home.php
I'm trying to create this effect: http://www.thecssninja.com/demo/css_tree/ the problem I'm having is that the
I am trying to create an add-in by using the article below http://blogs.microsoft.co.il/blogs/shair/archive/2008/07/28/how-to-create-sql-server-management-studio-addin.aspx I
Cross-post http://perlmonks.org/index.pl?node_id=979710 I'm trying to create a text file from some XML using Perl
I am trying to create a custom cursor using the following image: http://anuary.com/dev/hp/pad3/public/images/hand-cursor.png The
We are trying to create a web-service that we plan to pass a variable
I have a div with child divs that I'm trying to create a slideshow
I'm trying to create a xml using xslt. This is the xml that is
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

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.