How to obtain extensive battery info in iOS?

后端 未结 5 600
轻奢々
轻奢々 2021-01-13 12:46

I\'m wondering is it possible to receive information about battery like: capacity (mA), voltage (V), cycle count within iOS?

I know UIDevice class, but battery level

5条回答
  •  有刺的猬
    2021-01-13 13:23

    Look at the JSystemInfoKit library.

    You want to import the IOKit framework first (get the .framework file from here /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/IOKit.framework ) and IOKit headers (get those files from here) in your iOS project.

    Here you can find the methods you need to use to get extensive battery information.

    Plus, IOPSCopyPowerSourcesInfo (from IOPowerSources.h) returns a NSDictionary with more information like battery health.

提交回复
热议问题