美文网首页iOS开发
Telegram研究(1):安装环境

Telegram研究(1):安装环境

作者: 独孤流 | 来源:发表于2022-11-03 22:48 被阅读0次

    参考:
    https://github.com/TelegramMessenger/Telegram-iOS/issues/849
    https://github.com/TelegramMessenger/Telegram-iOS/issues/877
    https://github.com/TelegramMessenger/Telegram-iOS


    环境

    Intel MacOS 12.1
    java version "18.0.1"
    Python 3.8.9
    Xcode 13.4.1
    master最新分支
    release-9.0.2


    1、clone源代码

    git clone --recursive -j8 https://github.com/TelegramMessenger/Telegram-iOS.git
    

    2.1、进入下载后的源代码,

    cd Telegram-iOS
    

    2.2 并创建配置参数

    mkdir -p $HOME/telegram-configuration
    cp -R build-system/example-configuration/* $HOME/telegram-configuration/
    

    3、创建xcode项目

    python3 build-system/Make/Make.py \
        --overrideXcodeVersion \
        --cacheDir="$HOME/telegram-bazel-cache" \
        generateProject \
        --configurationPath="$HOME/telegram-configuration/development-configuration.json"  \
        --codesigningInformationPath "$HOME/telegram-configuration/fake-codesigning" \
        --disableExtensions \
        --disableProvisioningProfiles
    

    错误:Make generateProject: error: one of the arguments --gitCodesigningRepository --codesigningInformationPath is required

    解决方式:
    1、将xxx/Telegram-iOS/build-system/fake-codesigning 复制到 ~telegram-configuration/fake-codesigning
    2、将 xxx/Telegram-iOS/build-system/appstore-configuration.json 复制到 ~/telegram-configuration/development-configuration.json

    image.png

    增加参数:
    --codesigningInformationPath "$HOME/telegram-configuration/fake-codesigning"

    报xcode版本不匹配
    Required Xcode version is 14.0, but 13.4.1 is reported by 'xcode-select -p'
    解决方式:

    xxxx/Telegram-iOS/versions.json中的xcode版本改为安装版本一致即可或者增加参数--overrideXcodeVersion
    但是我本地报
    Make: error: unrecognized arguments: --overrideXcodeVersion
    --overrideXcodeVersion放在命令的generatProject前面就可以解决

    image.png

    改完后重新执行创建xcode项目的命令,然后就可以正常的创建项目了


    创建好项目后编译报错

    
    Showing Recent Errors Only
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/Telegram/BUILD:1952:16: ProcessEntitlementsFiles Telegram/Telegram_entitlements.entitlements failed: (Exit 1): plisttool failed: error executing command
    
    On target "//Telegram:Telegram", provisioning profile ExpirationDate ("2022-10-26T17:10:00") is in the past.
    
    Build did NOT complete successfully
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/build-input/gen/project/Telegram.xcodeproj/.tulsi/Scripts/bazel_build.py:590: Bazel build failed with exit code 1. Please check the build log in Report Navigator (⌘9) for more information.
    
    
    

    这是因为使用的证书都过期了,需要增加--disableProvisioningProfiles的参数

    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/Media/LocalAudioTranscription/Sources/LocalAudioTranscription.swift:57:37: Value of type 'SFSpeechURLRecognitionRequest' has no member 'addsPunctuation'

    image.png

    原因是最新代码已经使用了iOS16的内容,xcode13不支持这个编译,暂时方式一:注释或使用kvo的方式解决


    image.png

    方式二:升级xcode到最新版本xcode14.0.1

    image.png
    Showing Recent Errors Only
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/BUILD:9:13: Compiling submodules/AsyncDisplayKit/Source/ASControlNode.mm failed: (Aborted): wrapped_clang_pp failed: error executing command
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASRecursiveUnfairLock.h:70:3: 'OSSpinLock' is deprecated: first deprecated in iOS 10.0 - Use os_unfair_lock() from <os/lock.h> instead
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASThread.h:282:5: 'OSSpinLock' is deprecated: first deprecated in iOS 10.0 - Use os_unfair_lock() from <os/lock.h> instead
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASThread.h:153:21: 'OSSpinLockTry' is deprecated: first deprecated in iOS 10.0 - Use os_unfair_lock_trylock() from <os/lock.h> instead
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASThread.h:178:11: 'OSSpinLockLock' is deprecated: first deprecated in iOS 10.0 - Use os_unfair_lock_lock() from <os/lock.h> instead
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/submodules/AsyncDisplayKit/Source/PublicHeaders/AsyncDisplayKit/ASThread.h:201:11: 'OSSpinLockUnlock' is deprecated: first deprecated in iOS 10.0 - Use os_unfair_lock_unlock() from <os/lock.h> instead
    
    Build did NOT complete successfully
    
    /Users/aaa/Documents/workspace/Telegram-source/Telegram-iOS/build-input/gen/project/Telegram.xcodeproj/.tulsi/Scripts/bazel_build.py:590: Bazel build failed with exit code 1. Please check the build log in Report Navigator (⌘9) for more information.
    

    #define AS_USE_OS_LOCK false改成#define AS_USE_OS_LOCK true

    image.png

    运行成功


    image.png

    相关文章

      网友评论

        本文标题:Telegram研究(1):安装环境

        本文链接:https://www.haomeiwen.com/subject/fkaetdtx.html