Version: 3.12.0
Developing Apps for iOS
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...> > select the facerec.framework directory from the unpacked distribution package. It's not necessary to tick Copy items if needed in the Destination group. 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. It's not necessary to tick Copy items if needed in the Destination group. 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.m
and set the language: Identity and Type > Type > Objective-C++ Source. - Edit the code in
main.m
as shown in the example below:
- Let's use a picture of a face to check our demo. 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... > set the path to the picture. Don't forget to specify the path in the code (see the lineresources_dir + ...
).
- 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 look like this: