cocoa异步请求 and libxml2.dylib(13)
发布时间:2021-06-07
发布时间:2021-06-07
change:(NSDictionary *)change
context:(void *)context
{
if ([keyPath isEqual:@"isFinished"]) {
BOOL isFinished=[[change
objectForKey:NSKeyValueChangeNewKey] intValue];
if (isFinished) {//如果服务器数据接收完毕
[indicatorView stopAnimating];
URLOperation* ctx=(URLOperation*)context;
NSStringEncoding
enc=CFStringConvertEncodingToNSStringEncoding(kCFStringEncodingGB_18030_2000);
NSLog(@"%@",[[NSString alloc] initWithData:[ctx data] encoding:enc]);
//取消kvo注册
[ctx removeObserver:self
forKeyPath:@"isFinished"];
}
}else{
// be sure to call the super implementation
上一篇:春颂阅读及答案