它是如何做到的,我不需要将数据对象放在选择器调用方法中?
带有警告的代码(本地数据声明):
NSDictionary *data = [NSDictionary dictionaryWithObjectsAndKeys:@"SiluetaImage", @"ACTION", silueta_id, @"siluetaid", siluetaTyp_id, @"siluetatypid", nil];
[self performSelector:@selector(downloadBinDataForTyp:data:)
withObject:@"SiluetaImage"
withObject:data];
没有警告的代码:
[self performSelector:@selector(downloadBinDataForTyp:data:)
withObject:@"SiluetaImage"
withObject:[NSDictionary dictionaryWithObjectsAndKeys:@"SiluetaImage", @"ACTION", silueta_id, @"siluetaid", siluetaTyp_id, @"siluetatypid", nil]];
选择器:
- (void)downloadBinDataForTyp:(NSString *)typ data:(NSDictionary*)data
{
ASINetworkQueue *q = [self queue];
NSString *sUrl = @"url_web_service";
ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:[NSURL URLWithString:sUrl]];
NSString *msgLength = [NSString stringWithFormat:@"%d", [[self getMsg] length]];
[request setTimeOutSeconds:60];
[request addRequestHeader: @"Content-Type" value:@"text/xml; charset=utf-8"];
[request addRequestHeader: @"SOAPAction" value:_action];
[request addRequestHeader: @"Content-Length" value:msgLength];
[request setRequestMethod: @"POST"];
request.userInfo = data;
[request appendPostData:[self getMsg]];
[request setDelegate:self];
[q addOperation:request];
[q go];
}