NSString* stradd = [NSString stringWithFormat:@"%s" , sznetadd];
std::string result = ""; //在xcode中调试没有问题,发布审核时会崩溃。日志显示时这里
Reachability *r = [Reachability reachabilityWithHostName:stradd];
switch ([r currentReachabilityStatus])
{
case NotReachable:// 没有网络连接
result = "";
break;
case ReachableViaWWAN:// 使用3G网络
result = "3g";
break;
case ReachableViaWiFi:// 使用WiFi网络
result = "wifi";
break;
default:
result = "no Net";
break;
}
return result;
std::string result = ""; //在xcode中调试没有问题,发布审核时会崩溃。日志显示时这里
Reachability *r = [Reachability reachabilityWithHostName:stradd];
switch ([r currentReachabilityStatus])
{
case NotReachable:// 没有网络连接
result = "";
break;
case ReachableViaWWAN:// 使用3G网络
result = "3g";
break;
case ReachableViaWiFi:// 使用WiFi网络
result = "wifi";
break;
default:
result = "no Net";
break;
}
return result;
sznetadd这个是nil,格式化空对象造成崩溃。
td::string *string = new std::string([yourNSString UTF8String]);