iPhone Battery Percentage on OS X (Cocoa) like iTunes

孤人 提交于 2019-12-24 13:12:24

问题


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.



来源:https://stackoverflow.com/questions/27805987/iphone-battery-percentage-on-os-x-cocoa-like-itunes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!