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

Sandboxed Mac apps that use online appId / appKey must allow outgoing network:
macOS network permission
Camera (optional): NSCameraUsageDescription in Info.plist.

Import

AppKit types (NSImage) require #import <AppKit/AppKit.h> (usually via the prefix header or the engine header on macOS).

Log configuration

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

Create the engine

Bind the macOS 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. For command-line tools without a Bundle ID, bind the process name in the Dashboard.

Skin beauty

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

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

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.
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 NSImage.
Set type then call processImage: (no extra mode argument). Output keeps the input format.
FBFrameTypeVideo is for live streams; FBFrameTypeImage is for stills and NSImage.
YUV planes: dataY, dataU, dataV, dataUV and matching strides.

External texture

Create the engine on the OpenGL thread and set externalContext = YES. Input and output textures must share that context. macOS uses desktop OpenGL 3.2 Core (NSOpenGLContext / CGL), not OpenGL ES.
For TRTC / Agora / LiveKit: Third-party Integration.

Lifecycle

Keep a strong reference on the NSViewController. Stop the capture session when the view disappears or the window miniaturizes. Nil the engine when the session ends.