2

ASIHTTPRequestのWebサイトによると:

リクエストがすべて同じブロードタイプであるが、それらを区別したい場合は、完成した/失敗したデリゲートメソッドで読み取ることができる独自のカスタムデータを使用して、各リクエストのuserInfoNSDictionaryプロパティを設定できます。

userInfoを設定するにはどうすればよいですか?

NSURL *url = [NSURL URLWithString:@"http://www.google.com"];
ASIFormDataRequest *request = [[ASIFormDataRequest alloc] initWithURL:url];
[request setDelegate:self];
[request startAsynchronous];
4

3 に答える 3

8
request.userInfo = [NSDictionary dictionaryWithObjectsAndKeys: dataObject, key, nil];
于 2010-02-26T16:10:39.363 に答える
2
request.userInfo = [[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil];

そうしないと、次のようなエラーが発生します。不変オブジェクトに送信されたミューティングメソッド

于 2011-03-28T15:49:24.123 に答える
2

ドット表記よりもブラケットを使用する場合:

[request setUserInfo:[[NSMutableDictionary alloc] initWithObjectsAndKeys:@"init", @"operation", nil]];
于 2011-08-17T09:27:00.913 に答える