Skip to content

跑通 macOS 示例程序

环境要求

  • macOS 版本: macOS 10.14 及以上
  • 开发语言: Objective-C
  • 架构支持: x86_64, arm64 (Apple Silicon)

获取示例源码

克隆 github 仓库 到本地, 进入 macos/demo/FBExampleObjc 目录, 打开 Xcode 工程

bash
# clone 
git clone https://github.com/pixpark/facebetter.git

从 SDK 下载页面,下载最新的 macOS 版本库,放置到工程目录 macos/demo/FBExampleObjc/libs

配置 AppID 和 AppKey

按照 此页面 指引,获取 appidappkey, 打开工程中 ViewController.m, 修改 appidappkey

objc
  FBEngineConfig *engineConfig = [[FBEngineConfig alloc] init];
  engineConfig.appId = @"your appId"; 
  engineConfig.appKey = @"your appkey"; 
 
  self.beautyEffectEngine = [FBBeautyEffectEngine createEngineWithConfig:engineConfig];

运行工程

打开 macos/demo/FBExampleObjc/FBExampleObjc.xcodeproj 工程

  1. 确保 Xcode 工程签名正确 Xcode 签名

  2. 确保开放联网权限,用于校验 appkey Xcode 签名

  3. 确保 Facebetter 库已经正确链接 Xcode 链接库

  4. 编译运行

选择目标设备(Mac 或模拟器),点击编译运行按钮即可