This guide provides comprehensive instructions for setting up, building, and distributing a custom Telegram iOS client. The project uses Bazel as its build system and requires several configuration steps.
- Visit https://core.telegram.org/api/obtaining_api_id
- Create a Telegram application
- Obtain your
api_id
andapi_hash
- Generate a random identifier for your bundle ID:
openssl rand -hex 8
- Create a free or paid Apple Developer Account at https://developer.apple.com
- Locate your:
- Developer email address
- Team ID (in Membership Details section)
Clone the Telegram iOS repository with all submodules:
git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git
Edit build-system/template_minimal_development_configuration.json
:
- Add
api_id
andapi_hash
- Include your Apple Developer email
- Add your Team ID
- Set bundle identifier as
org.{random identifier}
Run the project generation command:
python3 build-system/Make/Make.py \
--overrideXcodeVersion \
--cacheDir="$HOME/telegram-bazel-cache" \
generateProject \
--configurationPath=build-system/template_minimal_development_configuration.json \
--disableProvisioningProfiles \
--xcodeManagedCodesigning
- Open the generated Xcode project
- Select an iOS simulator
- Build and run the project (⌘R)
-
Go to https://developer.apple.com/account/resources/certificates/list
-
Create Apple Push Notifications service SSL Certificate:
- Choose "Apple Push Notifications service SSL (Sandbox & Production)"
- This single certificate works for both development and production environments
-
Certificate Generation Process:
- Click the "+" button in the Certificates section
- Select the Apple Push Notifications service SSL certificate
- Follow the certificate generation wizard
- You'll need to:
- Generate a Certificate Signing Request (CSR) using Keychain Access
- Upload the CSR to Apple's developer portal
- Download the generated certificate
-
Open Keychain Access
-
Find the downloaded APNS certificate
-
Export to .p12:
- Right-click and select "Export"
- Choose .p12 format
- Set a strong password for the exported file
-
Convert .p12 to .pem:
# Convert the certificate to PEM format openssl pkcs12 -in apns-cert.p12 -out apns-cert.pem -nodes -clcerts
- Go to https://appstoreconnect.apple.com
- Click "My Apps" and "+"
- Select "New App"
- Fill in details:
- Platform: iOS
- Name: [Your App Name]
- Bundle ID: org.[random identifier].Telegram
- SKU: [random identifier]
- Go to https://developer.apple.com/account/resources/certificates/list
- Create iOS App Development certificate
- Generate Certificate Signing Request (CSR) using Keychain Access
- Return to certificates page
- Create "App Store and Ad Hoc" certificate
- Upload CSR
- Download and install certificate
Prepare a my-codesigning
folder with the following exact structure:
my-codesigning/
├── certs/
│ ├── Public.cer
│ └── SelfSigned.p12
└── profiles/
├── BroadcastUpload.mobileprovision
├── Intents.mobileprovision
├── NotificationContent.mobileprovision
├── NotificationService.mobileprovision
├── Share.mobileprovision
├── Telegram.mobileprovision
├── WatchApp.mobileprovision
├── WatchExtension.mobileprovision
└── Widget.mobileprovision
- Go to Identifiers section
- Create identifiers for:
- Main App
- Notification Service Extension
- Share Extension
- Widget
- Watch App and Extension
- Go to Profiles section
- Create profiles for each app identifier
- Select "App Store" type
- Download all profiles
- Ensure exact naming as shown in the codesigning folder structure
python3 build-system/Make/Make.py \
--overrideXcodeVersion \
--cacheDir="$HOME/telegram-bazel-cache" \
build \
--configurationPath=build-system/my-appstore-configuration.json \
--codesigningInformationPath=build-system/my-codesigning \
--buildNumber=100008 \
--configuration=release_arm64
- Use Apple's Transporter app
- Sign in with Apple Developer account
- Upload generated IPA
- Configure beta testing in App Store Connect