Add the framework and use App Shielding APIs

Prev Next

Adding the framework

When using the APIs provided by App Shielding, the header files and library must be available during compilation.

To add the framework bundle to your project

  1. In the project navigator, select the project with which you want to use App Shielding.

  2. In the editor view, select the target with which you want to use App Shielding.

  3. Select the General tab.

  4. Drag and drop ShieldSDK.xcframework from the App Shielding development package into the Frameworks, Libraries and Embedded Content section.

  5. Verify that Embed&Sign is selected in the drop-down list for ShieldSDK.xcframework.

Any code that wants to use an App Shielding API must then import the appropriate header file. You will also need to run the Shielding Tool on the app, either from the command line or within Xcode. If you do not run the Shielding Tool on the app, the APIs will not work, as App Shielding is not injected and available until then.

In the shielding procedure on the OneSpan Mobile Portal, you also need to shield the app through the portal. If you skip it, the App Shielding APIs will not work because App Shielding will not be injected.

If you add the ShieldSDK.xcframework bundle to your project, you must run the Shielding Tool on the app before distributing it. Otherwise, validation will fail with a MinimumOSVersion error. This is an intentional safeguard against accidentally distributing an unprotected app.

Dependency Managers

If you use a dependency manager that zips the XCFramework, or you zip the XCFramework yourself, you must ensure that the symlinks are preserved to avoid invalidating the signature. This is accomplished using the zip command -y option. For example:

zip -r -y ShieldSDK.xcframework.zip ShieldSDK.xcframework

If your dependency manager does not have an option to preserve symlinks, you can re-sign the XCFramework bundle with your own distribution certificate after unpacking the zip file.

Framework integration

It is also possible to use App Shielding APIs in a framework that is embedded in the main app. The main app must still add the  ShieldSDK.xcframework bundle as described above. The framework also needs to add the  ShieldSDK.xcframework bundle under its Frameworks and Libraries section. However, the Embed option at the framework level must be set to Do Not Embed.

App Shielding APIs can be used from the framework and the main app at the same time. However, they will use the same App Shielding instance, so any call to App Shielding from the app equally affects the framework, and vice versa.