如何检测iPhone上3G或Wi-Fi上运行的数据? [英] How to detect wheter running on 3G or Wi-Fi on iPhone?

查看:70
本文介绍了如何检测iPhone上3G或Wi-Fi上运行的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一些代码行?有经验吗?

Some lines of code? Any experience?

推荐答案

因为我做了一个非常简单的基于块的可到达性包装程序,该包装程序将所有过时的类似于C的可到达性代码剥离,并注入了更多的可可形式.

Since than I made a pretty simple block based Reachability wrapper that strips all the outdated C-like Reachability code, poured into a much more Cocoa form.

用法类似:

[EPPZReachability reachHost:hostNameOrIPaddress
               completition:^(EPPZReachability *reachability)
{
    if (reachability.reachableViaCellular) [self doSomeLightweightStuff];
}];

还可以与IP地址配合使用,事实证明这是一种非常罕见的可达性包装器功能.

It also works with IP addresses, which turned out to be a pretty rare Reachability wrapper feature.

这篇关于如何检测iPhone上3G或Wi-Fi上运行的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆