Integrate a framework

This page contains the detailed manual on how to integrate a framework to your mobile application

The guide assumes you have already got a framework and run a demo application. If you haven't done it yet please get back to the previous steps.

Frameworks API

Provided frameworks have a public interface to be used in custom iOS apps. To integrate the framework into your app, use the corresponding API methods.

Go to Face Detection API and Pose Tracking API to learn how to integrate a framework into your mobile application.

Framework Integration

Follow the steps below to start using a framework in your application

1. Copy framework into the root of the target application

cp -R frameworks/ModelFramework.framework /path/to/project/frameworks

2. Open your application in XCode

3. Disable Bitcode embedding

Project.xcodeproj -> Build Settings -> Build Options -> Enable Bitcode

4. Set Framework Search Paths to /path/to/project/frameworks

Project.xcodeproj -> Build Settings -> Search Paths -> Framework Search Paths

5. Import the framework public headers in the bridging header

#ifndef PROJECT_BRIDGING_HEADER_H
#define PROJECT_BRIDGING_HEADER_H

// ...

#import <ModelFramework/ModelFramework.h>

#endif // !PROJECT_BRIDGING_HEADER_H

For Swift-only projects bridging header is required to generate bindings for class from Objective-C frameworks.

If it's not created yet or/and the project doesn't have any Objective-C code, add a new header file to the project root named $(PROJECT_NAME)-Bridging-Header.h (It's the most common naming convention).

Update the path to the bridging header: Project.xcodeproj -> Build Settings -> Swift Compiler - General -> Objective-C Bridging Headerto point to the generated header.

6. Link application target with the framework

Project.xcodeproj -> Application Target -> Build Phases -> Link Binary with Libraries

7. Sign and embed the framework

Project.xcodeproj -> Application Target -> General -> Frameworks, Libraries, and Embedded Content

8. Build and run the application on the target device

Last updated