On AWAREFramework-iOS, some sensors need to send a permission request for using the API and set special configurations on Info.plist. This document shows that the best practice for importing these sensors as extensions into your Xcode project.
Supported extensions
AWAREFramework-iOS has six types of extension as follows:
- Bluetooth
- Motion Activity (Pedometer and Activity Recognition)
- HealthKit
- Calendar (Calendar and CalendarESM)
- Contact
- Microphone (Ambient Noise and Conversation )
Import extension(s)
The later than version 1.7, you can import a minimum number of extension(s) by using subspec
function on CocoaPods. In addition to the existing pod 'AWAREFramework'
, you need to add the following code into Podfile
and execute pod update
. (Please use only your required extension(s).)
pod 'AWAREFramework/Microphone' pod 'AWAREFramework/MotionActivity' pod 'AWAREFramework/Bluetooth' pod 'AWAREFramework/Calendar' pod 'AWAREFramework/Contact' pod 'AWAREFramework/HealthKit'
This idea (to use subspec
) is from Teemu Polvi. Thank you for sharing the good solution.
Update configuration
Finally, please update Info.plist
and Signing&Capabilities
on Xcode as follows:
Extension Name | Required Key into Info.plist | Note |
Activity Recognition | NSMotionUsageDescription | |
Pedometer | NSMotionUsageDescription | |
Bluetooth | NSBluetoothAlwaysUsageDescription | Add Background Modes on Signing&Capabilities, and check Uses Bluetooth LE Accessories |
Ambient Noise | NSMicrophoneUsageDescription | Add Background Modes on Signing&Capabilities, and check Audio, AirPlay, and Picture in Picture |
Conversation | NSMicrophoneUsageDescription | Add Background Modes on Signing&Capabilities, and check Audio, AirPlay, and Picture in Picture |
Calendar | NSCalendarsUsageDescription | |
Contact | NSContactsUsageDescription | |
HealthKit | NSHealthClinicalHealthRecordsShareUsageDescription and NSHealthShareUsageDescription | Add HealthKit Capability on Signing&Capabilities |