-3

我正在尝试向服务器发出请求,但我不知道为什么它不起作用。这是我当前的代码:

NSURL *url = [NSURL URLWithString:@"http://www.www.www/www"];
    AFHTTPClient *httpclient = [[AFHTTPClient alloc] initWithBaseURL:url];
    [httpclient defaultValueForHeader:@"Accept"];

    NSDictionary *params = [NSDictionary dictionaryWithObjectsAndKeys:valor, parametre, nil];


    NSMutableURLRequest *request = [httpclient requestWithMethod:@"PUT"
                                                            path:@"http://www.www.www/www"
                                                      parameters:params];
    //AFNetworking
    AFHTTPRequestOperation *afnet = [[AFHTTPRequestOperation alloc] initWithRequest:request];
    [afnet start];

    NSLog(@"%@: %@",[afnet responseString], [[afnet error] localizedDescription]);
4

1 回答 1

1

它不起作用,因为路径无效,路径是您的基本 url 的额外部分,它会更改。您正在将完整的 URL 替换为路径。

于 2013-01-30T18:00:41.307 回答