根据ASIHTTPRequest的网站:
如果您的请求都是相同的广义类型,但要区分它们,则可以使用自己的自定义数据设置每个请求的userInfo NSDictionary属性,这些数据可以在已完成的/失败的委托方法中读取。
如何设置userInfo?
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setDelegate:self];
[request startAsynchronous];发布于 2010-02-26 16:10:39
request.userInfo = [NSDictionary dictionaryWithObjectsAndKeys: dataObject, key, nil];发布于 2011-03-28 15:49:24
request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil];否则,您将得到一个错误,例如:将方法发送到不可变对象。
发布于 2011-08-17 09:27:00
如果您喜欢括号而不是点符号:
[request setUserInfo:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil]];https://stackoverflow.com/questions/2342041
复制相似问题