编译Telegram for iOS
1、git clone Telegram
git clone https://github.com/peter-iakovlev/Telegram.git
2、加载Git Submotule依赖
打开”.submodule”文件:
1 2 3 4 5 6 7 8 9 |
[submodule "thirdparty/ActionSheetPicker"] path = thirdparty/ActionSheetPicker url = https://github.com/skywinder/ActionSheetPicker-3.0.git [submodule "thirdparty/SSignalKit"] path = thirdparty/SSignalKit url=https://github.com/peter-iakovlev/Signals.git [submodule "submodules/MtProtoKit"] path = submodules/MtProtoKit url = git@github.com:iakovlev-peter/MtProtoKit.git |
修改MtProtoKit的url为https方式,整个文件修改后如下:
1 2 3 4 5 6 7 8 9 |
[submodule "thirdparty/ActionSheetPicker"] path = thirdparty/ActionSheetPicker url = https://github.com/skywinder/ActionSheetPicker-3.0.git [submodule "thirdparty/SSignalKit"] path = thirdparty/SSignalKit url=https://github.com/peter-iakovlev/Signals.git [submodule "submodules/MtProtoKit"] path = submodules/MtProtoKit url = https://github.com/iakovlev-peter/MtProtoKit.git |
回退MtProtoKit的版本:
1 2 3 4 |
cd submodules/MtProtoKit git checkout e4171b4 |
然后执行以下命令并等待完成:
1 2 3 4 |
git submodule sync git submodule update --init --recursive |
3、申请API_ID和API_HASH
访问该网址:https://my.telegram.org/,登录后点击“API development tools”申请API_ID和API_HASH。

4、创建config.h

添加以下内容(需要填写上一步申请来的值哦):
1 2 3 4 |
#define SETUP_API_ID(apiId) apiId = 123456; #define SETUP_API_HASH(apiHash) apiHash = @"536f868c09cfbc81399401da424e42e6"; |
修改TGShareContextSignal.m对config.h的引用路径:

5、编译运行
