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 NameRequired Key into Info.plistNote
Activity RecognitionNSMotionUsageDescription
PedometerNSMotionUsageDescription
BluetoothNSBluetoothAlwaysUsageDescriptionAdd Background Modes on Signing&Capabilities, and check Uses Bluetooth LE Accessories
Ambient NoiseNSMicrophoneUsageDescriptionAdd Background Modes on Signing&Capabilities, and check Audio, AirPlay, and Picture in Picture
ConversationNSMicrophoneUsageDescriptionAdd Background Modes on Signing&Capabilities, and check Audio, AirPlay, and Picture in Picture
CalendarNSCalendarsUsageDescription
ContactNSContactsUsageDescription
HealthKitNSHealthClinicalHealthRecordsShareUsageDescription
and
NSHealthShareUsageDescription
Add HealthKit Capability on Signing&Capabilities
Minimizing a sensor import on AWAREFramework-iOS