iPhone - 跟踪手机数据使用情况

Uni*_*orn 13 iphone objective-c cellular-network ios core-telephony

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

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

任何帮助将不胜感激.

San*_*ade 7

检查蜂窝网络使用此功能

- (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;
}
Run Code Online (Sandbox Code Playgroud)

  • http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring/8014012#8014012检查此数据的使用情况 (5认同)

Eri*_*ric 2

您可以查询每个网络接口以获取通过它的数据。


归档时间:

查看次数:

9336 次

最近记录:

9 年,11 月 前