1

AFNetworking に問題があります。私の Web サービスは、タイプ NSString の 2 つのパラメーターが YES または NO を返すことを期待しています。私のコードはこれです

AFHTTPClient *httpClient = [[AFHTTPClient alloc] initWithBaseURL:[NSURL URLWithString:@" http://webservice.com "]];

NSMutableURLRequest *request = [httpClient requestWithMethod:@"GET"
                                                        path:path
                                                  parameters:@{
                                @"password":@"password",
                                @"username":@"username"}


                                ];

AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]initWithRequest:request];

operation.outputStream = [NSOutputStream outputStreamToFileAtPath:path append:NO];

[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject)  {

    NSLog(@"success: %@", operation.responseString);


}
                                  failure:^(AFHTTPRequestOperation *operation, NSError *error) {
                                      NSLog(@"error: %@",  operation.responseString);

                                  }
 ];

NSLog(@"%@", operation.request);

[operation start];

それは書いていません:

NSLog(@"success: %@", operation.responseString); あなた

NSLog(@"エラー: %@", operation.responseString);

つまりブロックに入りません。

なにか提案を?

ご挨拶

4

0 に答える 0