Telegram iOS 编译流程

2,899 阅读1分钟

Telegram iOS 编译流程

OverView

环境

Telegram Version:Telegram 10.0.3 (26855) Xcode Version: 15.0

步骤

  1. 创建Telegram应用 获取自己的api_id

  2. 代码拉取

`git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git` 
  • --recursive 会读取 .gitmodules 文件,并拉取子模块
  • -j<n>(-job<n>) 同时抓取的子模块数。默认为 submodule.fetchJobs 选项
  1. 生成随机id
openssl rand -hex 8
  1. 创建一个新的Xcode项目。使用Telegram作为产品名称。使用org.{openssl rand -hex 8}作为组织标识符。

  2. 打开“钥匙链访问并选择证书Apple Development:your@email.address(XXXXXXXXXX)并双击证书。在详细信息下,找到组织单位, 这是团队ID。

  3. 编辑build-system/template_minimal_development_configuration.json

{
	"bundle_id": "org.xx.Telegram",
	"api_id": "xx",
	"api_hash": "xx",
	"team_id": "xx",
	"app_center_id": "0",
	"is_internal_build": "true",
	"is_appstore_build": "false",
	"appstore_id": "0",
	"app_specific_url_scheme": "tg",
	"premium_iap_product_id": "",
	"enable_siri": false,
	"enable_icloud": false
}
  1. 生成xcode项目
python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=build-system/template_minimal_development_configuration.json \
    --xcodeManagedCodesigning
  1. 生成完毕,自动打开xcode