iPhone - Track cellular data usage

前端 未结 2 954
庸人自扰
庸人自扰 2020-12-31 08:39

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 pro

2条回答
  •  误落风尘
    2020-12-31 09:21

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

提交回复
热议问题