Tracking multiple NSURLConnections
Tracking multiple NSURLConnections
- Subject: Tracking multiple NSURLConnections
- From: email@hidden
- Date: Tue, 29 Jun 2010 16:00:34 +0000
I have and app that needs to send out multiple connection attempts.
NSURLConnection doesn't appear to allow one to distinguish between
connections. I found a couple of posts at cocoabuilder that provide some
guidance, but I wanted to ask about my approach. I'm writing for 10.6, so
I'm using a category on NSURLConnection combined with associative
references. The methods in the category are below, but basically I
associate an integer with a given connection and track the connections
using that. So, short of subclassing or following what I've found in the
archives, does this make sense? Am I missing any details that might cause
this to fail?
Thanks
-(void)setTagValue:(NSNumber*)val{
objc_setAssociatedObject(self, @selector(tagValue), val,
OBJC_ASSOCIATION_RETAIN);
}
-(NSNumber *) tagValue {
return objc_getAssociatedObject(self, @selector(tagValue));
}
_______________________________________________
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