Usage of IOS Private APIs such as IOKit Framework

Hi,

I am developping an app for IOS using React Native. I want to write a native modules in Swift and use Objective C to bridge the React Native JS functions with native component. In particular, i want to use IOKit framework to access such information as Battery Temperature and Battery Level. I read in many stackoverflow articles and in ChatGPT that the usage of IOS Private APIs are forbidden andd Apple will reject the app from AppStore and block the account.

Is it true? Is there any legal way to use low level APIs and avoid to be rejected or blocked by Apple?

The official Apple Technical Support is not responding me.

I would really appreciate your help and support.

Best Regards, Kamran

Accepted Reply

If an API is private then yes your app will get rejected from the App Store. As to whether iokit is private, it doesn't look like it for 3 reasons: 1) you can find documentation about it by googling, a private api has no available documentation 2) it doesn't say it is 3) Eskimo doesn't say anything about it being private in his comment here: https://developer.apple.com/forums/thread/719564

Replies

If an API is private then yes your app will get rejected from the App Store. As to whether iokit is private, it doesn't look like it for 3 reasons: 1) you can find documentation about it by googling, a private api has no available documentation 2) it doesn't say it is 3) Eskimo doesn't say anything about it being private in his comment here: https://developer.apple.com/forums/thread/719564

want to use IOKit framework to access such information as Battery Temperature and Battery Level.

I believe that while IOKit itself is not private, using it for those purposes is not allowed.

Hmmm, there are a bunch of layers here…

First up, a general comment: There’s no such thing as a private API. If it’s private then, by definition, it’s not an API.

Second, regarding I/O Kit, the story here changed with the introduction of DriverKit on iOS 16. Prior to that, the IOKit framework wasn’t in the iOS SDK, making it completely unavailable on iOS. Starting with iOS 16, the IOKit framework is available on iOS. However, its behaviour isn’t like that on macOS. You can’t use it to rummage through the I/O registry looking at random properties. The API is present solely to support apps containing DriverKit extensions.

Finally, just because something is in the I/O registry doesn’t make it API. macOS developers hit this all the time.

macOS has very few limits on I/O Kit usage [1] and so there’s nothing to stop you doing what you propose there. And indeed many macOS developers do just that. However, this isn’t supported and often causes problems. Unless a driver’s class and its properties are documented for third-party use, it’s not an API but an implementation detail. If you rely on it, your product might fail as the implementation changes.

Many product experienced exactly this problem during the move to Apple silicon )-:

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

[1] Except in the case of sandboxed apps.