• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
threads and delegates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

threads and delegates


  • Subject: threads and delegates
  • From: julius <email@hidden>
  • Date: Wed, 15 Dec 2010 16:10:12 +0000

Hello all,

I'm  hoping you can help me with a question about threads and delegates.
I don't have the terminology to pose the question suscinctly so I'll do so by reference to the program which gave rise to it.

I have an object which implements a number of delegate methods of NSURLConnection:
- (void)connection: didReceiveResponse:
- (void)connection: didReceiveData:
- (void)connection: didFailWithError:
- (void)connectionDidFinishLoading:

The object also contains a custom method makeConnection which creates an NSURLRequest and makes a call to NSURLConnection

NSURLConnection * myConnection = [[NSURLConnection alloc] initWithRequest:myRequest delegate:self];

after which we test myConnection and return.

My code is an almost perfect copy of the example provided in
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html

I got the code to execute perfectly and then put the makeConnection method on a separate thread using NSInvocationOperation and NSOperationQueue. What happened was that I could not get any of the delegates to be called.

Now my question:
1. Why do they not get called?
2. How does one create a situation where they do get called?

Thanks in advance
Julius

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: threads and delegates
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Intercepting cocoa/quartz/opengl Draw command.
  • Next by Date: Re: threads and delegates
  • Previous by thread: Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker
  • Next by thread: Re: threads and delegates
  • Index(es):
    • Date
    • Thread