我正在尝试从响应中获取数据。
我正在使用NSURLConnectionDelegate
, NSURLConnectionDataDelegate
。
该项目使用ARC。
@interface MainMenu()
@property (nonatomic, unsafe_unretained) NSMutableData* wpData;
@end
@implementation
-(void)sendRequest{
NSURL* url = [[NSURL alloc] initWithString:@"http://smthing"];
NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init];
NSString* reqBody = @"Block";
NSData* reqData = [reqBody dataUsingEncoding:NSUTF8StringEncoding];
[request setURL:url];
[request setHTTPBody:reqData];
[request setHTTPMethod:@"POST"];
self.wpData = [NSMutableData data];
NSURLConnection* conection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
[conection start];
}
-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
//Here iI have [__NSMallocBlock__ appendData:]: unrecognized selector sent to instance 0x95f3fb0
[self.wpData setLength:0];
}
@end
也许你能发现我的错误
谢谢 :)