2 panda lizy Panda_Lizy 于 2014.07.28 22:00 提问

使用HTTPRequestOperationWithRequest方法创建一个对象失败

一个iOS的single view项目,想要使用HTTPRequestOperationWithRequest方法创建一个对象,但是不知道这么使用。

  • (IBAction)jsonTapped:(id)sender { NSString *weatherUrl = [NSString stringWithFormat:@"%@weather.php?format=json",BaseURLString]; NSURL *url = [NSURL URLWithString:weatherUrl]; NSURLRequest *request = [NSURLRequest requestWithURL:url];

**‘AFHTTPRequestOperation *operation = [AFHTTPRequestOperation    HTTPRequestOperationWithRequest:request success:^(AFHTTPRequestOperation *operation, id responseObject) failure:^(AFHTTPRequestOperation *operation, NSError *error)];’** 

[operation start];
}

##

就是上图分割线粗体高亮处报错expected expression,调了一晚上,都快哭了,呜呜呜~

希望有大虾能帮忙一下啊!

附AFNetworking源码:
- (AFHTTPRequestOperation *)HTTPRequestOperationWithRequest:(NSURLRequest *)request
success:(void (^)(AFHTTPRequestOperation *operation, id responseObject))success
failure:(void (^)(AFHTTPRequestOperation *operation, NSError *error))failure
{
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc] initWithRequest:request];
operation.responseSerializer = self.responseSerializer;
operation.shouldUseCredentialStorage = self.shouldUseCredentialStorage;
operation.credential = self.credential;
operation.securityPolicy = self.securityPolicy;
[operation setCompletionBlockWithSuccess:success failure:failure];
operation.completionQueue = self.completionQueue;
operation.completionGroup = self.completionGroup;
return operation;
}

######
谢啦!!!

2个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2015.01.20 11:25
kengsir
kengsir   2016.08.24 16:12
Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!