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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:08:59+00:00 2026-06-12T22:08:59+00:00

just a small question with a simple and short answer I hope ;-) What

  • 0

just a small question with a simple and short answer I hope 😉

What exactly is the difference between (i.e.)

NSData *htmlData = [NSURLConnection sendSynchronousRequest:self.request returningResponse:&response error:nil];

and

NSData *htmlData = [NSData dataWithData:[NSURLConnection sendSynchronousRequest:self.request returningResponse:&response error:nil]]

Or isn’t there any difference at all? If it matters, yes I use ARC.

Thanks a lot!

  • 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-12T22:09:01+00:00Added an answer on June 12, 2026 at 10:09 pm

    There is not a simple and short answer 🙂

    In the first, you handle the data returned from the URL connection.

    In the second, you create a copy of that data — that ‘copy’ btw, may not actually be a deep copy for a number of reasons.

    How this performs can actually go both ways, and a lot of it is hard to answer because:

    • a) it depends largely on how your program uses that data and
    • b) internal optimizations and implementation details of the APIs you’re using
    • c) copy or retain semantics of your objects

    Personally, I prefer the latter when I need to pass that data around. The reason is that you should declare your ivars for types which have mutable variants as copy (NSMutableData in this case), and you should generally work with immutable copies of these objects where possible. Once much of your implementations handle these types with mutable variants by copy, then you can actually reduce copying by ensuring the objects you deal with are in fact immutable — immutable objects can avoid deep and even shallow copies when a copy is requested.

    If that data is passed nowhere else, then you could avoid a potential copy in the event the API returns an instance of NSMutableData (i.e. you can use the first safely).

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

Sidebar

Related Questions

Just a small question I can't find an answer to. If I add a
This is admittedly a very simple question that I just can't find an answer
Just a small question regarding joins. I have a table with around 30 fields
I'm learning JavaFX and this is just a small programming question. I have 3
I'm sorry to ask such a simple question with such a small amount of
it's just a simple question: I have a layout file which is presented as
I have a very simple question, but can't seem to find a strait answer
I just have a small beginners question, and it's about the code below. I
I Just learnig the PHP scipt and Mysql. My question is a simple one
Ok, my question is simple, though I am unsure if the answer will be.

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.