@selector(apiRequest:didFinishWithData :)即使抓取器完成数据也不会执行。我试图用断点调试问题。当我在断点处循环时,我从选择器调用的方法不会被执行和绕过。这是因为选择器不在主线程上运行吗?我怎么能纠正这个?
OADataFetcher *fetcher = [[OADataFetcher alloc] init];
[fetcher fetchDataWithRequest:request
delegate:self
didFinishSelector:@selector(apiRequest:didFinishWithData:)
didFailSelector:@selector(apiRequest:didFailWithError:)];
(void)apiRequest:(OAServiceTicket *)ticket didFinishWithData:(NSData *)data {
if (ticket.didSucceed) {
NSString *responseBody = [[NSString alloc] initWithData:data
encoding:NSUTF8StringEncoding];
NSLog(responseBody);
//could use this to implement errors
NSError* error;
NSDictionary* json = [NSJSONSerialization
JSONObjectWithData:data //1
options:kNilOptions
error:&error];}
}