Skip to main content
This page matches SDK 2.0.0. Auth: Auth & License. Makeup / reshape enums: Parameter enums.

Add SDK dependency

Xcode 15+ compilation errorIf you are using Xcode 15 or later, you might encounter a Sandbox: rsync.samba deny(1) error. This is caused by User Script Sandboxing.Solution:
  1. Select your Project in Xcode.
  2. Open Build Settings.
  3. Search for ENABLE_USER_SCRIPT_SANDBOXING.
  4. Change the value from Yes to No.

Method B: Manual framework

Download the SDK from Download, copy Facebetter.framework into the project, and embed the dynamic library with Embed & Sign.
Xcode Link Library

Permissions

Add camera permission in Info.plist only if the app captures from the camera:

Import

Log configuration

Logging is off by default. Call setLogConfig: before creating the engine.

Create the engine

Bind the iOS Bundle ID, then pass either licenseToken or appId + appKey. See Get AppID and AppKey and Auth & License. Priority: if licenseToken is non-empty (license token string, {token} JSON, or .lic contents), the SDK validates it locally. Otherwise it uses appId + appKey against /facebetter/v2/auth.
createEngineWithConfig: returns an instance, not a singleton.

Skin beauty

Intensity is typically [0.0, 1.0]. Style enums: Parameter enums.

Skin-only

When enabled, smoothing / whitening / rosiness apply only to detected skin.

Face reshape

setReshape:intensity: range is [-1.0, 1.0]. 0 is off. Parameters: FBReshape_FaceThin … FBReshape_BrowThickness (0–25). Meanings: Parameter enums.

Body reshape

setBodyReshape:intensity: range is [0.0, 1.0]. 0 is off. Register resource_body.fbd with addResourcePack: first. Parameters: FBBodyReshape_BodySlim … FBBodyReshape_TorsoLong (0–8). See Parameter enums and Optional resource packs.

Makeup

Intensity, shape, and color are separate calls. Full presets: Parameter enums.

Virtual background

Portrait segmentation is the default mask. Blur level is [0.0, 1.0]; 0 clears blur. Image path must be a non-empty png/jpg.

Chroma key

Chroma key replaces the mask only. Fill is still blur or the replacement image.

Filters and stickers

Pass a .fbd file path or in-memory bytes. Changes take effect on the next processImage:.
3D stickers need the optional resource_3d.fbd pack (not in the framework). See Optional resource packs:

Callbacks and stats

Process images

FBImageFrame supports I420, NV12, NV21, RGB, RGBA, BGR, BGRA, file, texture, and UIImage.
Set type then call processImage: (no extra mode argument). Output keeps the input format.
FBFrameTypeVideo is for live streams; FBFrameTypeImage is for stills.
Rotate / mirror / convert / save:
YUV planes: dataY, dataU, dataV, dataUV and strideY / strideU / strideV / strideUV.

External texture

Create the engine on the OpenGL ES thread and set externalContext = YES. Input and output textures must share that context.
Recommended texture params: GL_LINEAR, GL_CLAMP_TO_EDGE. The engine does not delete your input texture. Output textures are owned by the SDK. For TRTC / Agora / LiveKit: Third-party Integration.

Lifecycle

Keep a strong reference for the session. Nil the engine when the view controller is gone. Pause the capture session when leaving the screen so you stop calling processImage:.