iPhone数据使用情况监控 [英] iPhone Data Usage Monitoring

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

问题描述

可能重复:
iPhone数据使用情况跟踪/监控

Possible Duplicate:
iPhone Data Usage Tracking/Monitoring

我正在尝试构建一个数据使用情况监视" iphone应用程序作为快速演示,但是还无法弄清楚如何以编程方式获取CellularData/Wifi使用情况统计信息.

I'm trying to build a "Data Usage Monitoring" iphone app as a quick demo, but haven't been able to figure out how to get CellularData/Wifi usage statistics programmatically.

我知道这是可能的,因为在应用程序商店中为此有多个应用程序(DataUsage,DataMan).

I know this is possible, as there are several apps in the app store for this (DataUsage, DataMan).

我知道一个事实,那就是它们并没有废弃蜂窝提供商的页面来获取数据使用情况,所以我想知道他们如何能够实现这一目标.

I know for a fact that these are not scrapping the cellular provider's pages to get the data usage, so I'm wondering how they are able to achieve this.

在iOS 4.2 SDK文档中找不到任何内容.

Couldn't find anything in the iOS 4.2 SDK Documentation.

我猜他们以某种方式获取了显示在设置->常规->使用情况"下的数据,

I'm guessing they are somehow getting the data that is displayed under "Settings -> General -> Usage",

推荐答案

嘿,这是未经测试的-我在模拟器上尝试过,但显然它不存储任何数据使用情况统计信息.尝试在 iPhone 设备上为这段代码试一下.

Hey, this is sort of untested - I tried it on the simulator, but it obviously doesn't store any data usage statistics. Try to give this code a shot on an iPhone device.

NSLog(@"Contents of the user defaults: %@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);

它应该打印出用户首选项的 entire 内容.然后,您应该能够找出适当的键来访问所需的数据.

It should print out the entire contents of the users preferences. You should then be able to dig out the appropriate keys for accessing the data you need.

告诉我它是否有效:D

Tell me whether it works or not :D

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

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