2011-09-02 88 views
0

在視圖控制器中,我有不同的ASIFormDataRequests有不同的finishSelectors的多個方法。所以了methodA - > finishselector(AFinished :),的methodB - > finishselector(BFinished :)和methodC - > finishselector(CFinished :)ASINetworkQueue是否支持多個requestDidFinishSelectors?

我有個1種方法,可處理的所有請求,如下所示:

-(void)sendRequest:(NSURL *)url withParams:(NSDictionary *)params andSelector:(NSString *)selector 
{ 
NSString *jsonString = [params yajl_JSONString]; 
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url]; 
[request setPostValue:jsonString forKey:@"json"]; 
[request setTimeOutSeconds:15]; 
[[self networkQueue] setDelegate:self]; 
[[self networkQueue] setRequestDidFinishSelector:NSSelectorFromString(selector)]; 
[[self networkQueue] setRequestDidFailSelector:@selector(asiRequestFailed:)]; 
[[self networkQueue] addOperation:request]; 
[[self networkQueue] go]; 
} 

我注意到,當我發送請求方法A-> B-> C和B完成之前,然後BFinished:將被調用兩次,首先與數據對應的方法B,然後數據對應的方法A.是否ASINetworkQueue一次處理1個finishSelector?我需要爲每種方法分開網絡隊列嗎?

感謝

回答