NSURLRequest *r = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:path]];
[r setHTTPBody:imageData];
r.HTTPBody = imageData;Xcode给出了第二行的错误:"No visible interface for 'NSURLRequest declares the selector 'setHTTPBody'"
和第三行"Assignment to readonly property"
但是类定义显示
/*!
@method HTTPBody:
@abstract Sets the request body data of the receiver.
@discussion This data is sent as the message body of the request, as
in done in an HTTP POST request.
@param data the new request body data for the receiver.
*/
@property (copy) NSData *HTTPBody;发布于 2015-07-23 21:29:53
常规的NSURLRequest是不可变的。使用NSMutableURLRequest。
发布于 2015-07-23 21:29:54
您提供了来自NSMutableURLRequest的定义,但在此属性为只读的情况下使用NSURLRequest。
https://stackoverflow.com/questions/31598320
复制相似问题