简体   繁体   English

iPhone - 跟踪蜂窝数据使用情况

[英]iPhone - Track cellular data usage

Is there a way to track cellular data usage on iPhone?有没有办法在 iPhone 上跟踪蜂窝数据使用情况? There are lot of apps which does the same like 'Dataman' and 'DataUsage'有很多类似“Dataman”和“DataUsage”的应用程序

Basically I am looking for a programmatic way to get information stored in Settings -> General -> Usage基本上我正在寻找一种编程方式来获取存储在设置中的信息 -> 常规 -> 使用

Any help will be appreciated.任何帮助将不胜感激。

To check Cellular Network Use this检查蜂窝网络使用这个

- (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;
}

You could query each network interface for the data going through it.您可以查询每个网络接口以获取通过它的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM