warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.

在httpDNS上进行判断host是否是IP时,程序假死,报错如上。

代码如下:

const char *addr= [request.URL.host UTF8String];
BOOL isIP = (inet_addr(addr) != INADDR_NONE);

卡到了第二句代码上,后来发现是addr为NULL了。这里需要做一个非空判断。
修改后代码:

const char *addr= [request.URL.host UTF8String];
if (addr == NULL) {
  // 在这里处理addr为空的情况
}
BOOL isIP = (inet_addr(addr) != INADDR_NONE);

Done!

附上cocoChina上关于类似bug的问题地址:
http://www.cocoachina.com/bbs/read.php?tid=331323&page=e&#a

你可能感兴趣的:(warning: could not load any Objective-C class information. This will significantly reduce the quality of type information available.)