Extension support
About extension support
With iOS extensions, you can extend functionality for your end-users beyond your app.
Our extension support feature allows your end-users to authenticate outside of your app; you can make content available to them whilst they are interacting with other apps or parts of the mobile operating system.
How to configure extension support
Prepare the project
Before extension support can be activated, you need to make some changes to the project.
Main target
- Open the project file, select the main target project, then click the Signing & Capabilities tab.
- Click +, then add App Groups and Keychain Sharing.
- In the Keychain Sharing section, add a new Keychain group. This must be exactly the same as the
BundleID, for examplecom.company.app. - In the App Groups section, add a new App Group. This must be exactly the same as the
BundleID, but preceded by the word 'group'. For example,group.com.company.app.
Extension target
- Open the project file, select the extension target project, then click the Signing & Capabilities tab.
- It is important that the
BundleIDfrom the extension target follows the Apple structure, and does not contain more than one period after the main application'sBundleID. For example,com.company.app.extensionName. - Click +, then add App Groups and Keychain Sharing.
- In the Keychain Sharing section, add a new Keychain group. This must be exactly the same as the main target
BundleID, for examplecom.company.app - In the App Groups section, add a new App Group. This must be exactly the same as the main target
BundleID, but preceded by the word 'group'. For example,group.com.company.app.
You have to add the same frameworks to the extension target as you have to the main app.
For further information, see the Frameworks required by the EncapSwiftAPI section on our iOS SDK Getting started page.
Enable extension support
After enabling extensionSupport, there is no way to rollback and disable it. To disable it, the end-user must be deactivated and forced to do a new registration.
To activate the extension support, you need to set the extensionSupport field of the configuration to true:
EncapController.shared.config.extensionSupport = true
How is the registration data handled?
- For new registrations, the data will be stored in the Shared Group and Shared Keychain when extension support is enabled.
- For existing registrations, the data will be migrated on the next successful authentication.
- If the registration has biometrics activated, then the data will only be migrated when the biometric authentication method is used to authenticate.
Keychain Sharing and App Groups are only accessible by apps made by members of the same Apple development team.
Check whether extension support is activated
You can use isActivatedWithExtensionSupport to check whether the registration is activated with extension support. To do this:
EncapController.shared.isActivatedWithExtensionSupport()
Perform an authentication
To authenticate, you should use the same authentication method as in the main app. For more information, see our authentication methods page.
If isActivatedLocally is returning false from an extension, this means that either:
- The end-user has not activated with
extensionSupportenabled. - The end-user has not migrated yet.
When extensionSupport is enabled, the app can check isActivatedLocally and isActivatedWithExtensionSupport to identify situations where a migration is required before using this feature.
Error codes
The table below illustrates error codes related to extension support.
You can find the corresponding error descriptions in our SDK error codes documentation.