Skip to main content

Installation via CocoaPods

Integration with your app is supported via CocoaPods

The Metric iOS SDK is distributed as an XCFramework, therefore you are required to use CocoaPods 1.9.0 or newer.

  1. If you are not yet using CocoaPods in your project, first run sudo gem install cocoapods. (For further information on installing CocoaPods, Here's a guide)

  2. Run pod init in the root directory of your project to create a Podfile.

  3. Add the following to your Podfile (inside the target section):

    pod 'MetricSDK', :podspec => 'https://raw.githubusercontent.com/Metric-Africa/metric-sdk-ios/main/MetricSDK.podspec'
  4. Run pod install

Dependencies

The Metric iOS SDK has a dependency on Starscream. OpenSSL-Universal.

These dependencies will be automatically included via CocoaPods.

XCode 14.0+ Error

There's a dynamic linking issue on macOS/iOS for the newer XCode versions for certain dynamic frameworks. If you ever run into dyld error like below after running pod install and trying to run your project,

...
dyld[532]: Symbol not found: __ZN5swift34swift50override_conformsToProtocolEPKNS_14TargetMetadataINS_9InProcessEEEPKNS_24TargetProtocolDescriptorIS1_EEPFPKNS_18TargetWitnessTableIS1_EES4_S8_E
Referenced from: <CF434E50-4753-32B1-BC49-77FF3D123A82> /private/var/containers/Bundle/Application/AD967DEA-F01C-4CC7-A8D3-00A0911EBBC0/SDKSample.app/Frameworks/iProov.framework/iProov
Expected in: <B8F7D7D2-01AE-35BF-B0B7-91D6488B6E35> /private/var/containers/Bundle/Application/AD967DEA-F01C-4CC7-A8D3-00A0911EBBC0/SDKSample.app/Frameworks/Starscream.framework/Starscream
...

put the following lines of code at the bottom of your Podfile

...
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '11.0'
config.build_settings['BUILD_LIBRARY_FOR_DISTRIBUTION'] = 'YES'
end
end
end
...

and run the following commands

  1. pod deintegrate
  2. pod install
  • Quit XCode and open the pod generated .xcworkspace file