ASIHTTPRequest和用户信息
-
23-09-2019 - |
题
据该网站为ASIHTTPRequest:
如果您的要求都是一样的 广阔的类型,但你要 区分它们,您可以设置 的用户信息的NSDictionary属性 与自己的自定义数据的每个请求 你可以在你完成/阅读 失败委托方法。
如何设置用户信息?
NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
解决方案
request.userInfo = [NSDictionary dictionaryWithObjectsAndKeys: dataObject, key, nil];
其他提示
request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil];
否则会得到一个错误,如:突变方法发送到不可变objectt
如果你喜欢括号内为点记号:
[request setUserInfo:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil]];
不隶属于 StackOverflow