Re: NSURLDownload and userInfo

2008-03-12 Thread Adam Leonard
Well, there are a few more places I see it used for delegate-like operations :) NSCachedURLResponse - also in WebKit NSTrackingArea NSEvent (called userData) NSBeginAlertSheet() (called contextInfo) So yeah, you are right it is not used everywhere, but I think it is used enough for it to be

Re: NSURLDownload and userInfo

2008-03-12 Thread Jens Alfke
On 12 Mar '08, at 12:39 AM, Trygve Inda wrote: I am surprised NSURLDownload and NSURLRequest do not have userInfo ivars like many other Cocoa classes that do asynchronous operations (NSTimer for instance). Thanks for this. I too am surprised there is no userInfo in these classes and wanted t

Re: NSURLDownload and userInfo

2008-03-12 Thread Trygve Inda
> Hi, > Oh, sorry, replace everything in that message with NSURLDownload, same > idea. > I agree with your original approach, especially if you just need to > store an int (or an NSNumber in this case). > > There is a reason almost every delegate method in Cocoa passes the > delegate object as a p

Re: NSURLDownload and userInfo

2008-03-11 Thread Adam Leonard
Hi, Oh, sorry, replace everything in that message with NSURLDownload, same idea. I agree with your original approach, especially if you just need to store an int (or an NSNumber in this case). There is a reason almost every delegate method in Cocoa passes the delegate object as a parameter

Re: NSURLDownload and userInfo

2008-03-11 Thread Ben Lachman
On Mar 11, 2008, at 10:42 AM, Jens Alfke wrote: I don't know if I agree with the working with the APIs bit. I think it's obvious that the APIs expect a single delegate to be able to handle multiple objects using it concurrently, thus the passing of the object that is delegating to the dele

Re: NSURLDownload and userInfo

2008-03-11 Thread Jens Alfke
On 10 Mar '08, at 8:06 PM, Ben Lachman wrote: I don't know if I agree with the working with the APIs bit. I think it's obvious that the APIs expect a single delegate to be able to handle multiple objects using it concurrently, thus the passing of the object that is delegating to the deleg

Re: NSURLDownload and userInfo

2008-03-11 Thread Trygve Inda
> Or, yet another solution: > Just subclass NSURLConnection (say MyUserInfoURLConnection), add a > userInfo ivar, drop in some accessors, and you are good to go. :) > [userInfoConnection userInfo]; My code is: NSURLRequest*urlRequest = [NSURLRequest requestWithURL:theURL cachePolicy:NSURLReq

Re: NSURLDownload and userInfo

2008-03-10 Thread Adam Leonard
Or, yet another solution: Just subclass NSURLConnection (say MyUserInfoURLConnection), add a userInfo ivar, drop in some accessors, and you are good to go. :) [userInfoConnection userInfo]; Adam Leonard On Mar 10, 2008, at 6:52 PM, Jens Alfke wrote: On 10 Mar '08, at 6:35 PM, Ben Lachman

Re: NSURLDownload and userInfo

2008-03-10 Thread Ben Lachman
On Mar 10, 2008, at 9:52 PM, Jens Alfke wrote: On 10 Mar '08, at 6:35 PM, Ben Lachman wrote: Alternatively, if you're managing more than two requests at a time you can declare a mutable array of connections and then build a dictionary for each connection that includes any info you want you

Re: NSURLDownload and userInfo

2008-03-10 Thread Jens Alfke
On 10 Mar '08, at 6:35 PM, Ben Lachman wrote: Alternatively, if you're managing more than two requests at a time you can declare a mutable array of connections and then build a dictionary for each connection that includes any info you want you delegate to have available. I think it's cle

Re: NSURLDownload and userInfo

2008-03-10 Thread Ben Lachman
Alternatively, if you're managing more than two requests at a time you can declare a mutable array of connections and then build a dictionary for each connection that includes any info you want you delegate to have available. I have a method that build the connection dict for a connection

Re: NSURLDownload and userInfo

2008-03-10 Thread Clint Shryock
Do you have two instances of NSURLDownload? if they are declared in the .h file you could test for equality in the downloadDidFinish: delegate method. - (void)downloadDidBegin:(NSURLDownload *)download { if(download == myNSURLDownloadA) { // something for a } if(download == myNSURLDownl

NSURLDownload and userInfo

2008-03-09 Thread Trygve Inda
I am using NSURLDownload and NSURLRequest to download 2 different types of data (A & B)... Both of which are related to the same class so they share delegate methods. In my delegate, when there is an error or successful completion I need to call one "process method" for A and a different one for B