This page matches SDK 2.0.0. Auth: Auth & License. Enums: Parameter enums.
Integration
Engine creation returns nil
- Confirm
licenseTokenorappId+appKeyis set. Token wins if both are present. - Bind the app Bundle ID in the dashboard.
- Online auth needs network to
/facebetter/v2/auth. - Enable logs before
createEngineWithConfig:and watch events1(license fail) and101(init fail). - CocoaPods:
pod 'Facebetter', '2.0.0'. Open the.xcworkspace, not the.xcodeproj.
Missing headers or classes
- Import
#import <Facebetter/FBBeautyEffectEngine.h>. - For a manual
.framework, set Embed & Sign. - Clean Build Folder and rebuild.
- If CocoaPods scripts fail on Xcode 15+, set
ENABLE_USER_SCRIPT_SANDBOXINGto No.
Runtime link / dyld errors
- Architecture must be arm64.
- Deployment target iOS 12.0+.
- Confirm
Facebetter.frameworkis in Embed Frameworks.
Auth
licenseToken vs appId / appKey
If licenseToken is non-empty, the SDK verifies that token / {token} JSON / .lic locally and does not send appId / appKey. Otherwise it uses online auth. Details: Auth & License.
Event 1 or 101
License or init failed. Check Bundle ID, plan, token expiry, and logs. Creation returning a non-nil object is not enough — listen to onEngineEvent.
Beauty
Effect is too weak or too strong
- Skin / makeup / filter:
[0.0, 1.0]. - Face reshape:
[-1.0, 1.0]viasetReshape:intensity:(0is off). - Body reshape:
[0.0, 1.0]viasetBodyReshape:intensity:. Registerresource_body.fbdfirst. - Intensity
0disables that effect. - Skin-only:
setBeautySkinOnly:.
Makeup / reshape enum values
Do not copy tables into app code comments — use Parameter enums. Objective-C names look likeFBReshape_FaceThin, FBLipstickColor_Rouge.
Filters, stickers, virtual background
Filter or sticker does nothing
Pass the.fbd path or bytes:
processImage: (GL thread). Empty path / nil data returns FBErrorCode_InvalidArgument. Missing file returns FBErrorCode_IO.
Virtual background
Processing
processImage: returns nil
- Engine is
nilor init failed (-2/ event101). - Invalid frame (zero size, unsupported format).
externalContext = YESbut the current thread has no GL context.- Treat as process failure (
FBErrorCode_Process).
Frame type
SetimageFrame.type to FBFrameTypeImage (0) or FBFrameTypeVideo (1). Do not pass a process-mode argument.
Format conversion
Useconvert: and the frame accessors:
dataY / dataU / dataV / dataUV and the matching stride*.
UIImage
Camera preview
- Read
CVPixelBufferfromAVCaptureVideoDataOutput. - Build
FBImageFramewithcreateWithNV12:...orcreateWithBGRA:.... - Set
type = FBFrameTypeVideo, optionalsetMirror:@"horizontal". processImage:then display[output data]or[output texture].
Performance and memory
- Use
FBFrameTypeVideofor live; lower resolution ifgetStats.avgProcessTimeMsis high. - One engine, serial queue; do not process on the main thread.
- Release frames with ARC (
frame = nil). Reuse capture buffers. - Avoid
setFilter:/setSticker:every frame.
Logging
0 success, -1 invalid argument, -2 not initialized. Full list: Error Handling.
Version
- iOS 12.0+, arm64.
- CocoaPods:
pod 'Facebetter', '2.0.0'. - After upgrade:
pod install, Clean Build Folder, re-test auth andprocessImage:.
Threading
- Default engine: serial queue for all
processImage:and setters that touch GL resources. externalContext = YES: create + process on the GL thread.- Update UI on the main queue only.

