使用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个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐