I'm trying to find a SDK or anything in Cocoa for OS X that will detect when an iPhone is connected and will show the battery percentage of the iPhone just like iTunes where it shows you how much your phone is charged (the little battery icon). So if anyone can tell me if there is something like this i thank you in advance. (BTW this has to be for OS X)
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Have a look at https://bitbucket.org/tristero/mobiledeviceaccess Specifically, getMobileGestaltValue: using the key BatteryCurrentCapacity That will give you the numeric value you want - displaying it is a different issue.
https://bitbucket.org/tristero/ipodaccessframework is a skeleton application that shows how to monitor for iDevices being connected...
In fact, https://bitbucket.org/tristero/ipodbattery is exactly what you want.