iPhone - 跟踪蜂窝数据使用情况 [英] iPhone - Track cellular data usage

查看:221
本文介绍了iPhone - 跟踪蜂窝数据使用情况的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法跟踪iPhone上的手机数据使用情况?有很多应用程序像'Dataman'和'DataUsage'那样做。

Is there a way to track cellular data usage on iPhone ? There are lot of apps which does the same like 'Dataman' and 'DataUsage'

基本上我正在寻找一种以编程方式获取存储在设置中的信息 - >一般 - >用法

Basically I am looking for a programmatic way to get information stored in Settings -> General -> Usage

任何帮助将不胜感激。

Any help will be appreciated.

推荐答案

检查手机网络使用此

- (bool) hasCellular {
    struct ifaddrs * addrs;
    const struct ifaddrs * cursor;
    bool found = false;
    if (getifaddrs(&addrs) == 0) {
        cursor = addrs;
        while (cursor != NULL) {
            NSString *name = [NSString stringWithUTF8String:cursor->ifa_name];
                if ([name isEqualToString:@"pdp_ip0"]) 
                    found = true;
            }
            cursor = cursor->ifa_next;
        }
        freeifaddrs(addrs);
    }
    return found;
}

这篇关于iPhone - 跟踪蜂窝数据使用情况的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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