ASIHTTPRequest and userInfo
-
23-09-2019 - |
문제
According to the website for ASIHTTPRequest:
If your requests are all of the same broad type, but you want to distinguish between them, you can set the userInfo NSDictionary property of each request with your own custom data that you can read in your finished / failed delegate methods.
How do I set userInfo?
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];
otherwise you will get an error like: mutating method sent to immutable objectt
If you prefer brackets to dot notation:
[request setUserInfo:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil]];
제휴하지 않습니다 StackOverflow