Hello,
I'm not very familiar with Mac OS, so it's entirely possible I'm misunderstanding or doing something wrong, but it appears that the Info.plist embedded by this crate isn't being recognised by the OS.
Context:
I'm working on a Rust Bluetooth library. Since Big Sur, accessing CoreBluetooth APIs apparently requires that the Info.plist contain a string NSBluetoothAlwaysUsageDescription
saying why the program wants to use it. When I embed an appropriate Info.plist with this crate and then run my binary from the command-line (either via cargo run
or directly), it crashes with Abort trap: 6
. If I run it inside lldb, I get an error message:
(lldb) run
Process 76410 launched: '/Users/qwandor/src/btleplug/target/debug/examples/lights' (x86_64)
2021-02-11 17:44:15.350059+0000 lights[76410:891761] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSBluetoothAlwaysUsageDescription key with a string value explaining to the user how the app uses this data.
Process 76410 stopped
* thread #12, queue = 'com.apple.root.default-qos', stop reason = signal SIGABRT
frame #0: 0x00007fff2059a792 libsystem_kernel.dylib`__abort_with_payload + 10
libsystem_kernel.dylib`__abort_with_payload:
-> 0x7fff2059a792 <+10>: jae 0x7fff2059a79c ; <+20>
0x7fff2059a794 <+12>: movq %rax, %rdi
0x7fff2059a797 <+15>: jmp 0x7fff205796a1 ; cerror_nocancel
0x7fff2059a79c <+20>: retq
Target 0: (lights) stopped.
If I instead copy the Info.plist to target/debug/examples/
alongside the binary, then running it directly still fails, but running in lldb then it prompts for the permission and runs correctly.
I'm on MacOS 11.2, x86_64, Rust 1.49.0, embed_plist 1.2.0. You can see my code trying to use it in deviceplug/btleplug#116.
So I guess there are two questions:
- Why does embedding the Info.plist not work, while putting it in the same directory does? (Is this a bug in the embed_plist crate?)
- Why does it only work when I run my binary under lldb? (Am I doing something wrong?)