Let’s imagine I have a method: -[myClass getDataForUser:user] and when it is done it calls a delegate’s method gotData: and the results appear on my main class. If I do two calls to getDataForUser:, for example:
[myClass getDataForUser:@"user1"];
[myClass getDataForUser:@"user2"];
how can I differentiate between these two calls in the delegate method?
EDIT:
The library is MGTwitterEngine, the two calls I make are -[_engine getDirectMessagesSinceID:1 startingAtPage:1]; and [_engine getSentDirectMessagesSinceID:1 startingAtPage:1]; and the delegate method is directMessagesReceived:forRequest:
Use an instance of MGTwitterEngine for each call, and give each instance a different delegate object. Inside each of these delegate objects, you can store the user id. Set these delegate objects so they can accept your original class as their delegates. Then you can use delegate gotData:(id)data forUser:(NSString *)user finally. Not pretty, but may work.