NSURLResponse *response =[[NSURLResponse alloc] initWithURL:requestingURL MIMEType:@"text/xml" expectedContentLength:-1 textEncodingName:nil]; webData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:response error:NULL];
我得到编译器警告说警告传递参数来自不兼容的指针类型。我怀疑这是因为nsurlresponse参数是一个双星参数(nsurlresponse**)?
我在这里做错什么了?
反应是 返回 以资参考。
NSURLResponse *response = nil; NSError *error = nil; NSData *data = [NSURLConnection sendSynchronousRequest: request returningResponse: &response error: &error];
这是调用它的正确方法,并通过引用返回响应和错误。
在上面的代码中,除了语法错误之外,还泄漏了响应对象。