SCNetworkReachability连接WIFI但不连接在Cellular上

时间:2015-03-20 05:53:40

标签: ios iphone networking reachability

我正在尝试连接3g网络,但scnetwork可达性不能正常工作...... 它在wifi上工作正常但在3g或边缘上出错

这是代码......

SCNetworkReachabilityContext context = { 0, &g_con, NULL, NULL, NULL };
SCNetworkReachability *reachability = SCNetworkReachabilityCreateWithName( NULL, "www.google.com" );
if( ! reachability )
    return;

if( ! SCNetworkReachabilitySetCallback( reachability, reachabilityCallback, &context ) )
    return;

SCNetworkReachabilityScheduleWithRunLoop( reachability, CFRunLoopGetMain(), kCFRunLoopDefaultMode );

0 个答案:

没有答案