alexmoon / bluest

Cross-platform Rust crate for working with Bluetooth Low Energy devices.
Apache License 2.0
55 stars 8 forks source link

An error was encountered while compiling iOS #20

Closed reformc closed 1 week ago

reformc commented 1 week ago

I wrote a crate, which works fine on macos (M2), but with an error when compiling to iPhone using tauri.

Undefined symbols for architecture arm64: "CBAdvertisementDataIsConnectable", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataLocalNameKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataManufacturerDataKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataOverflowServiceUUIDsKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataServiceDataKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataServiceUUIDsKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 "CBAdvertisementDataTxPowerLevelKey", referenced from: bluest::corebluetooth::types::$LT$impl$u20$bluest..AdvertisementData$GT$::from_nsdictionary::h40696a5a1084144b in libapp.a174 ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I remove the Bluetooth call, it compiles to the iPhone and runs fine.

alexmoon commented 1 week ago

Make sure you're linking your app with the Core Bluetooth framework.

reformc commented 1 week ago

It works. Thanks