threads and delegates
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