【发布时间】:2013-04-14 20:22:37
【问题描述】:
我正在尝试使用 AFNetworking(伟大的框架)向我的 Web 服务发出 GET 请求。这是请求的代码:
AFHTTPClient *httpClient = [[AFHTTPClient alloc]initWithBaseURL:[NSURL URLWithString:@"http://mywebservice.com/service/"]];
[httpClient setParameterEncoding:AFJSONParameterEncoding];
[httpClient registerHTTPOperationClass:[AFJSONRequestOperation class]];
NSMutableURLRequest *request = [httpClient getPath:@"http://mywebservice.com/service/contacts"
parameters:@{@"accessID":self.accessId, @"name":contactName}
success:^(AFHTTPRequestOperation *operation, id responseObject) {
//Success code
} failure:^(AFHTTPRequestOperation *operation, NSError *error) {
//Error code
}];
这会导致出现以下问题(指向我的 NSMutableURLRequest 实例): 使用不兼容类型“void”的表达式初始化“NSMutableURLRequest *__strong”
我不知道是什么原因造成的,因此我们将不胜感激。
【问题讨论】:
标签: ios objective-c json afnetworking