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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:28:55+00:00 2026-05-22T12:28:55+00:00

I am trying to create something like a Network Manager using NSUrlConnections. For that,

  • 0

I am trying to create something like a Network Manager using NSUrlConnections.
For that, I want to be able to send multiple requests, but I also want to be able to identify the client(delegate) that made the request when the response arrives.
I have created a NSDictionary like this:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:SERVER_TIMEOUT];
....
[clients setObject:client forKey:connection];

in “- (void)connectionDidFinishLoading:(NSURLConnection *)connection” I have something like this:

client = (id<RTANetworkDelegate>)[clients objectForKey:connection];
[clients removeObjectForKey:connection];

The Network Manager is the delegate for all the connections, I do some preprocessing and then I send the (parsed) response to the right delegate, that sent the request in the first place.

Unfortunately, it appears that a NSMutableURLRequest cannot be set as a key in a dictionary since it does not have the copyWithZone method and I get the error:

-[NSURLConnection copyWithZone:]:
unrecognized selector sent to
instance

Any help would be much appreciated!
Thanks!

=======================================

[Edit] I already found this in the meantime:

http://blog.emmerinc.be/index.php/2009/03/15/multiple-async-nsurlconnections-example/

It seems to solve my problem.. I still don’t know if it’s the best solution though. I thought I would post it here since it might help others too.

  • 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-22T12:28:56+00:00Added an answer on May 22, 2026 at 12:28 pm

    You could use the -hash value of the connection object as the key:

    [clients setObject:client forKey:[connection hash]];
    

    I’d stay away from the actual URL or anything similar as two requests could potentially have the same URL.

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

Sidebar

Related Questions

Im trying to create something that looks like this using php gd library: I've
I simply want to create something like that: <strong>blah blah</strong> I've been trying to
I'm trying to create a user control that allows users to make something like
I am trying to create a simple search box that results in something like
I am trying to create a simple php if statement that goes something like
I'm trying to create a sitemap using Linq to Xml, but am getting an
I'm trying to create something like a MDI tabbed Interface so I have a
I'm trying to create something like *.ascxs' factory. Scenario: I would like to render
I'm trying to create something like MsgProc in Win32. When they declare the MsgProc
I'm trying to create something that would have the looks of a tabbed interface

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.