IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app

I'm currently working with IOKit on Mac (I'm new to it, but managed to get a Serial USB demo working) and noticed that it says that IOKit is Mac Catalyst 13.0+ compatible. But when I

import IOKit

into my iOS Swift project. I'm getting a No such module 'IOKit' error.

Do I have to manually add this framework?

I read somewhere that IOKit access may not be possible on iOS/iPad devices, if I released my app on the App Store, but what about internal home or company iOS devices, that won't ever be released on the App Store??

Thanks.

Answered by Claude31 in 691305022

It is marked for MacCatalyst, MacOS, not iOS.

This is an old thread, but should still be valid: https://stackoverflow.com/questions/44792611/cannot-import-iokit-on-xcode-9-beta-2-or-xcode-8-3-3

Accepted Answer

It is marked for MacCatalyst, MacOS, not iOS.

This is an old thread, but should still be valid: https://stackoverflow.com/questions/44792611/cannot-import-iokit-on-xcode-9-beta-2-or-xcode-8-3-3

To force forum to load all posts !

If you enclose it with a proper #if ... #endif, it does not cause error.

#if os(macOS)
import IOKit
#endif

Please do not forget, IOKit is Mac Catalyst 13.0+ compatible does not mean it is available for iOS/iPadOS apps, even if the project contains MacCatalyst target. MacCatalyst is for macOS, not iOS.

IOKit is marked as Mac Catalyst 13.0+ compatible yet I'm unable to import it into my Swift iOS app
 
 
Q