私はasynchornusリクエストを実装しようとしています。私は私の研究を行なったし、これは私が得た最高のですが、コードは私が非同期リクエストを作成する
NSURL *url2 = [NSURL URLWithString:@"www.google.com"];
NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url2];
NSOperationQueue *queue = [[NSOperationQueue alloc] init];
[NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
{
if ([data length] > 0 && error == nil)
[delegate receivedData:data];//i get the error here use of undeclared identifier 'delegate' ,when I put self insead I receive the error : no visible @interface for "my class name" declares the selector "received data"
else if ([data length] == 0 && error == nil)
[delegate emptyReply];//same error here
else if (error != nil && error.code == ERROR_CODE_TIMEOUT) //the error here is "use of undelcared identifier ERROR_CODE_TIMEOUT
[delegate timedOut];//error here is save as the first one
else if (error != nil)
[delegate downloadError:error];//error here is save as the first one
}];
の解決方法が見つからないエラーの完全である私は私の.hファイルでNSURLConnectionDelegate
を追加している誰かが私に言うことができますエラーは何ですか?必要に応じて、デリゲートメソッドを実装し:デリゲート:initWithRequest -
おかげで
あなたの出力を貼り付けてくださいことはできますか? –