This guide is intended to explain how to integrate Face SDK into an XCode project. The created demo app shows such Face SDK features as initializing the libfacerec library and detecting facial landmarks in the picture.
You can find the tutorial project in Face SDK: examples/tutorials/ios_minimal_project
Note: Minimum supported iOS version is 11.4.
- Download and unpack the distribution package as described in Getting Started.
- Create a new XCode project: File > New > Project. Select the Single View App app type. Leave the default project settings. Choose the directory to store the project.
- Add the facerec framework to the app: in project settings, select General > Embedded Binaries > + > Add Other...> >, then select the facerec.framework directory from the unpacked distribution package. Tick Copy items if needed in the Destination group, if necessary. After that, click Finish.
- By default, the framework is automatically added to Linked Frameworks. Delete the framework from this list (linking at this stage is not required because the facerec library is loaded at runtime).
- Add the folders with necessary files (conf, license, share) to the project. In project settings, select Build Phases > + New Copy Files Phase > Copy Files > + > Add Other... > select the folders conf, license, share. Tick Copy items if needed in the Destination group, if necessary. After that, click Finish.
- Set the path to the headers from the distribution package. In project settings, select Build Settings > Search Paths > Header Search Paths >, double click left mouse button and drag-and-drop the include folder from the distribution package.
- Specify the supported architecture: Architectures > Valid Architectures > arm64.
- Edit the created project. Open
main.mand set the language: Identity and Type > Type > Objective-C++ Source.
- Edit the code in
main.mas shown in the example below:
- Check the demo using a face picture. You can use our example (the path to the picture is
bin/set1/01100.jpg) or upload your picture. Add the picture to the project: Copy Files > + > Add Other... > and set the path to the picture. Specify the path in the code (see the
resources_dir + ...line).
- Connect your iOS device to your computer and build the app (click Run). If an error occurs (see the image below), verify the developer certificate on your iOS device.
- The output should be as follows: