このコードを使用してリモートサーバー呼び出しを行おうとしています。
- (IBAction)login:(id)sender 
{    
    // Arguments are subject and body.
    NSString *urlString = @"my_url";
    NSString *email = self.email.text;
    NSString *password = self.password.text;
    NSString *url_to_send = [NSString stringWithFormat:urlString , email , password];;     
    NSString *escapedString = (__bridge NSString *)CFURLCreateStringByAddingPercentEscapes(NULL,
                                                                                  (__bridge CFStringRef)url_to_send,
                                                                                  NULL,
                                                                                  (CFStringRef)@"!*'();:@&=+$,/?%#[]",
                                                                                  kCFStringEncodingUTF8);
    // Now send to the server    
    NSURL *url = [NSURL URLWithString:escapedString];
    NSURLRequest *urlRequest = [NSURLRequest requestWithURL:url];
    // ***************
    // TODO: ok I dont really understand what this is
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    // **************
    [NSURLConnection sendAsynchronousRequest:urlRequest queue:queue completionHandler:^(NSURLResponse *response, NSData *data, NSError *error)
     {                  
         NSLog(@"This is data: %@" , data);
         NSLog(@"This is response: %@" , response);
         NSLog(@"This is error: %@" , error);
         if ( error == nil )
         {
             // Display a message to the screen.
         }
         else
         if ([data length] > 0 && error == nil)
         {
                 // Do something
         }
         else 
         {
             // Do something else                         
         }
     }];    
}
URLをエンコードしないと、実際にはエラーなしで返されます。しかし、URLをエンコードすると、次のエラーが発生します。
This is data: (null)
2012-07-08 11:10:56.110 BusinessPlan[1630:14603] This is response: (null)
2012-07-08 11:10:56.111 BusinessPlan[1630:14603] This is error: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo=0x684a180 {NSErrorFailingURLStringKey=My_encoded_url, NSErrorFailingURLKey=my_encoded_url, NSLocalizedDescription=unsupported URL, NSUnderlyingError=0x6895d00 "unsupported URL"}
このエラーはどういう意味ですか?間違ってエンコードしましたか?また、エンコードしないと、データオブジェクトと応答オブジェクトに値が返されますが、それらのオブジェクトからこれらの値を取得する方法がわかりませんでした。それらのオブジェクトにどのデータがあるかをどのように見分けることができますか?
ありがとう!