We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4299

Summary: A recent change requires Core Bluetooth framework on iOS
Product: SDL Reporter: Mark Callow <libsdl.org>
Component: *don't know*Assignee: Sam Lantinga <slouken>
Status: RESOLVED FIXED QA Contact: Sam Lantinga <slouken>
Severity: normal    
Priority: P2 CC: sdl-bugzilla, spydog
Version: HG 2.1   
Hardware: x86   
OS: Other   

Description Mark Callow 2018-10-07 01:06:20 UTC
I recently updated my hg tree. My tip is now changeset 12276. Sometime between 11906 & now  SDL started needing CoreBluetooth.framework when linking applications on iOS.

Is this intentional? I thought SDL tried to hide internally used libraries from applications.

I suspect this is coming from recent HID changes.
Comment 1 Sam Lantinga 2018-10-07 03:10:54 UTC
Actually it would be nice to start reducing the number of frameworks we need to link directly. We dynamically load shared libraries on other systems, is that something we can do with frameworks as well?
Comment 2 Mark Callow 2018-10-07 03:28:35 UTC
Yes. You load them in exactly the same way as .dylibs. You need to use the frameworks's name in  the  form XXX.framework/Versions/YYY/XXX or  XXX.framework/XXX, where XXX YYY are any name, rather thana .dylib name. Also dyld uses different search paths for frameworks and libraries.
Comment 3 Mark Callow 2018-10-07 23:15:20 UTC
I may be wrong. I think on iOS that App Store policy does not allow dynamic loading of frameworks. SDL may have to create what is called an umbrella framework to wrap the dependencies and hide them from SDL apps.
Comment 4 Sam Lantinga 2018-10-11 05:50:45 UTC
I think you are correct. The App Store policy does now allow bundling and linking with your own frameworks though, so I think I'm going to create a new iOS framework project post-2.0.9.
Comment 5 Sam Lantinga 2018-10-27 03:23:30 UTC
I disabled the Bluetooth code by default since it's not needed by most applications.
Comment 6 Dominik Reichardt 2020-03-30 18:44:13 UTC
The Bluetooth Framework dependency is back with SDL 2.0.12.
As a user this means:
- you need to add the dependency on your SDL2 app
- you need to add the neccessary info.plist information so your app doesn't get denied.

For mercurial this means that the demo project file needs to add the dependency, too.
And this change needs to be back in there, too https://hg.libsdl.org/SDL/rev/9bb50edccc46
Comment 7 Caleb Cornett 2020-04-14 01:23:53 UTC
Just ran into this, and from my testing, whatever re-added the dependency is a _major_ regression. Not only is your app forced to link with CoreBluetooth, but iOS has apparently tightened up security and won't even let you _test_ your app unless it specifies the NSBluetoothAlwaysUsageDescription in an Info.plist. It doesn't even pop up an error message, it just straight up crashes.

Adding the permission isn't a good solution either, since I'd really, really rather not have my app request users' bluetooth to always be enabled, especially if the only apparent reason is for Steam Controller support.
Comment 8 Sam Lantinga 2020-04-14 14:41:30 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/bd445097c0e5
Comment 9 Dominik Reichardt 2020-04-14 14:43:47 UTC
Don't you have to take the BT framework out of the iOS Xcode project as well?
Comment 10 Sam Lantinga 2020-04-14 15:09:02 UTC
Yep, this should be good now:
https://hg.libsdl.org/SDL/rev/f6e164b9a64a
https://hg.libsdl.org/SDL/rev/4b0fc4601e26