Adding the dependency
Cocaopods
Add the following dependencies to your Podfile
, in addition to the Core module, the IPS module, and optionally the Geo module:
pod 'CrowdConnectedCoreBluetooth', '1.6.1'
Swift Package Manager (SPM)
Open your project in Xcode and navigate to File -> Swift Packages -> Add Package Dependency and add the following package, in addition to the core module, the IPS module, and optionally the Geo module:
https://github.com/crowdconnected/crowdconnected-core-bluetooth-ios
Carthage
In your Cartfile
file add the following dependency, in addition to the core module, the IPS module, and optionally the Geo module:
binary "https://crowdconnected-public-maven.s3.eu-west-1.amazonaws.com/iOSSources/crowdconnected-corebluetooth-sources" == 1.6.1
Run the following command in terminal:
carthage update --use-xcframeworks --no-use-binaries
On your application targets’ General settings tab, in the Embedded Binaries section, drag and drop the following xcframework (in addition to the core module, the IPS module, and optionally the Geo module) from the Carthage/Build folder on disk.
CrowdConnectedCoreBluetooth.xcframework
Bluetooth Permission
The following additional entry in Info.plist is only required if you integrate the CoreBluetooth module to support Eddystone beacons. Although the entry is for 'Always Usage', it is nonetheless required for all integrations including foreground only use.
<key>NSBluetoothAlwaysUsageDescription</key>
<string>YOUR_DESCRIPTIVE_TEXT_HERE</string>
For iOS <=13, you will also need the following Info.plist entry:
<key>NSBluetoothPeripheralUsageDescription</key>
<string>DESCRIPTIVE_TEXT_NOT_SHOWN_TO_THE_USER</string>
A Bluetooth permission request will be triggered when the SDK includes and activates the CoreBluetooth module, and is started with an app key that has Eddystone beacons configured.
Starting the library
Add the IPS module to your imports.
import CrowdConnectedIPS
import CrowdConnectedCore
import CrowdConnectedCoreBluetooth
Then before you start the library, following the Base Integration Guide, activate the CoreBluetooth module.
CrowdConnectedIPS.activate()
CrowdConnectedCoreBluetooth.activate()
CrowdConnected.shared.start(appKey: "YOUR_APP_KEY", token: "YOUR_TOKEN", secret: "YOUR_SECRET") { deviceId, error in
// If the completion returns a non-nil Error, then the SDK has failed to start and is not functional.
// Otherwise, the completion will provide a valid device ID and a nil Error
}