문제

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]];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top