Telegram-iOS icon indicating copy to clipboard operation
Telegram-iOS copied to clipboard

Cannot build Telegram on Xcode 16

Open matinzd opened this issue 1 year ago • 16 comments

Checklist

  • [x] I am reporting an issue in existing functionality that does not work as intended
  • [x] I've searched for existing GitHub issues

Description

Recently, in Xcode 16, the provisioning profiles folder was moved from its previous location. While the upstream repository includes a fix for this change, it has not yet been applied to https://github.com/ali-fareed/rules_apple.

cc: @ali-fareed

You can find the fix here: https://github.com/bazelbuild/rules_apple/pull/2544

Applying this patch will fix the build:

From aa6aabad86e36cd71f7c452baa4906c9e89254c8 Mon Sep 17 00:00:00 2001
From: Adin Cebic <[email protected]>
Date: Tue, 24 Sep 2024 10:10:21 +0200
Subject: [PATCH 1/2] Support new Xcode 16 mobile provisioning location

Signed-off-by: Adin Cebic <[email protected]>
---
 apple/internal/local_provisioning_profiles.bzl | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/apple/internal/local_provisioning_profiles.bzl b/apple/internal/local_provisioning_profiles.bzl
index 50bdbc70a..18e998e0f 100644
--- a/apple/internal/local_provisioning_profiles.bzl
+++ b/apple/internal/local_provisioning_profiles.bzl
@@ -10,10 +10,19 @@ def _provisioning_profile_repository(repository_ctx):
     repository_ctx.execute(["mkdir", "-p", system_profiles_path])
     repository_ctx.symlink(system_profiles_path, "profiles")
 
+    # Since Xcode 16 there is a new location for the provisioning profiles.
+    # We need to keep the both old and new path for quite some time.
+    user_profiles_path = "{}/Library/Developer/Xcode/UserData/Provisioning Profiles".format(repository_ctx.os.environ["HOME"])
+    repository_ctx.execute(["mkdir", "-p", user_profiles_path])
+    repository_ctx.symlink(user_profiles_path, "user profiles")
+
     repository_ctx.file("BUILD.bazel", """\
 filegroup(
     name = "profiles",
-    srcs = glob(["profiles/*.mobileprovision"], allow_empty = True),
+    srcs = glob([
+    "profiles/*.mobileprovision",
+    "user profiles/*.mobileprovision",
+    ], allow_empty = True),
     visibility = ["//visibility:public"],
 )
 

From d2cf011acab719daeee4bbc7d12c980e8ddbaadf Mon Sep 17 00:00:00 2001
From: Adin Cebic <[email protected]>
Date: Tue, 24 Sep 2024 10:11:30 +0200
Subject: [PATCH 2/2] Fix indentation

Signed-off-by: Adin Cebic <[email protected]>
---
 apple/internal/local_provisioning_profiles.bzl | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apple/internal/local_provisioning_profiles.bzl b/apple/internal/local_provisioning_profiles.bzl
index 18e998e0f..71d5275ae 100644
--- a/apple/internal/local_provisioning_profiles.bzl
+++ b/apple/internal/local_provisioning_profiles.bzl
@@ -20,8 +20,8 @@ def _provisioning_profile_repository(repository_ctx):
 filegroup(
     name = "profiles",
     srcs = glob([
-    "profiles/*.mobileprovision",
-    "user profiles/*.mobileprovision",
+      "profiles/*.mobileprovision",
+      "user profiles/*.mobileprovision",
     ], allow_empty = True),
     visibility = ["//visibility:public"],

Expected Behavior

Build should succeed when following the README.

Actual Behavior

App is failing with error:

no provisioning profile was found named ....

Steps to Reproduce

  1. Update to MacOS sequoia and xcode 16
  2. Follow README
  3. Build will fail

Screenshots and Videos

N/A

Environment

Device: Simulator

iOS version: 18.0

App version: ...

matinzd avatar Oct 05 '24 21:10 matinzd

The relevant changes have been merged to https://github.com/ali-fareed/rules_apple/tree/reproducible-codesign-no-check

ali-fareed avatar Oct 06 '24 09:10 ali-fareed

So I guess you need to update the submodule HEAD commit here as well as Telegram iOS does not have those changes. Feel free to close it when it's done.

matinzd avatar Oct 06 '24 15:10 matinzd

@matinzd Your patch corrupted

Screenshot 2024-10-09 at 16 22 39

Pogosito avatar Oct 09 '24 13:10 Pogosito

@ali-fareed I checkout to this thread https://github.com/ali-fareed/rules_apple/tree/reproducible-codesign-no-check and try to build project, same issue

Pogosito avatar Oct 09 '24 14:10 Pogosito

@matinzd Your patch corrupted

Apply it manually then. It depends on how you are applying it.

matinzd avatar Oct 10 '24 07:10 matinzd

@ali-fareed I checkout to this thread https://github.com/ali-fareed/rules_apple/tree/reproducible-codesign-no-check and try to build project, same issue

Have you followed the README for generating the xcode project?

Use this command instead with --xcodeManagedCodesigning:

python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=build-system/template_minimal_development_configuration.json \
    --xcodeManagedCodesigning

matinzd avatar Oct 10 '24 07:10 matinzd

@matinzd Thank you for response

Yes, I'm using the command you mentioned (staying here in submodule https://github.com/ali-fareed/rules_apple/tree/reproducible-codesign-no-check), but still have problem with

Screenshot 2024-10-10 at 18 30 48

Maybe another submodule must be updated ? staying on 1d1ea447ad3fdbf9483ce337c532cf0793f3ab3a commit

Xcode 16.0 macOS 15.0.1 Device: Simulator iOS version: 18.0

P.s do I need to choose my profile ? Screenshot 2024-10-10 at 18 36 23

Pogosito avatar Oct 10 '24 15:10 Pogosito

Look for Telegram target under targets and change the signing to automatic. That should work. Now I see you are on bazel_dependencies target.

matinzd avatar Oct 10 '24 16:10 matinzd

@matinzd Sorry for pinging you again. I am on Telegram target Screenshot 2024-10-11 at 10 39 11

Pogosito avatar Oct 11 '24 07:10 Pogosito

I have the same problem

SyysBiir avatar Oct 11 '24 11:10 SyysBiir

I have the same problem

Adhambec avatar Oct 12 '24 11:10 Adhambec

Yeah now this same problem.

Does it anything do with using a free apple developer account ?

EshanSingh-ES avatar Oct 12 '24 12:10 EshanSingh-ES

@SyysBiir @EshanSingh-ES I don't know why, but I tried to build on real device and its works!

Pogosito avatar Oct 12 '24 15:10 Pogosito

And I tried to build it on simulator and it works .

On Sat, 12 Oct 2024 at 9:20 PM, Pogos @.***> wrote:

I don't know why, but I tried to build on real device and its works!

— Reply to this email directly, view it on GitHub https://github.com/TelegramMessenger/Telegram-iOS/issues/1568#issuecomment-2408607477, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGA7IDSMLUD52JAVPMNR6ODZ3FAMLAVCNFSM6AAAAABPNWAJNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYGYYDONBXG4 . You are receiving this because you commented.Message ID: @.***>

EshanSingh-ES avatar Oct 12 '24 15:10 EshanSingh-ES

And I tried to build it on simulator and it works . On Sat, 12 Oct 2024 at 9:20 PM, Pogos @.> wrote: I don't know why, but I tried to build on real device and its works! — Reply to this email directly, view it on GitHub <#1568 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGA7IDSMLUD52JAVPMNR6ODZ3FAMLAVCNFSM6AAAAABPNWAJNKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMBYGYYDONBXG4 . You are receiving this because you commented.Message ID: @.>

can you help me with this

Adhambec avatar Oct 12 '24 19:10 Adhambec

Look for Telegram target under targets and change the signing to automatic. That should work. Now I see you are on bazel_dependencies target.

Hi @matinzd, I changed the signing on Telegram target to automatic, but it still gives the following error: Screenshot 2024-10-14 at 17 40 16 Screenshot 2024-10-14 at 17 40 42

Xcode 15.3 macOS 14.4.1 Device: Simulator

ChuoiChien1102 avatar Oct 15 '24 01:10 ChuoiChien1102

Look for Telegram target under targets and change the signing to automatic. That should work. Now I see you are on bazel_dependencies target.

Hi @matinzd, I changed the signing on Telegram target to automatic, but it still gives the following error: Screenshot 2024-10-14 at 17 40 16 Screenshot 2024-10-14 at 17 40 42

Xcode 15.3 macOS 14.4.1 Device: Simulator

You are on Telegram project. Find Telegram under targets and then go to signing and capabilities tab. Then check automatic xcode signing.

matinzd avatar Oct 15 '24 03:10 matinzd

Look for Telegram target under targets and change the signing to automatic. That should work. Now I see you are on bazel_dependencies target.

Hi @matinzd, I changed the signing on Telegram target to automatic, but it still gives the following error: Screenshot 2024-10-14 at 17 40 16 Screenshot 2024-10-14 at 17 40 42 Xcode 15.3 macOS 14.4.1 Device: Simulator

You are on Telegram project. Find Telegram under targets and then go to signing and capabilities tab. Then check automatic xcode signing.

Thank you so much! I found the Telegram target, but I checked automatically manage signing Screenshot 2024-10-15 at 12 38 21

then run and still got the same error as above Showing All Messages "no provisioning profile was found named 'iOS Team Provisioning Profile: org.fbe5713796172893.Telegram"

ChuoiChien1102 avatar Oct 15 '24 05:10 ChuoiChien1102

That's the same exact problem I had and I was getting these warnings. As soon as I applied that patch it started working. Try to disable app extensions as it's not needed for this contest and try again.

python3 build-system/Make/Make.py \
    --cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=build-system/template_minimal_development_configuration.json \
    --xcodeManagedCodesigning \
    --disableExtensions

I guess these are the questions that Telegram team should answer, not me. I hope they clarify these problems in the documentation. Hope that helps.

matinzd avatar Oct 15 '24 06:10 matinzd

cp -r ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles/* Library/MobileDevice/Provisioning\ Profiles - it helps me

3ema208 avatar Oct 15 '24 12:10 3ema208

That is a temporary solution but it should work. Because xcode 16 has changed the provisioning profiles folder.

matinzd avatar Oct 15 '24 13:10 matinzd

cp -r ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles/* Library/MobileDevice/Provisioning\ Profiles - it helps me

Manually copying the provisioning profiles using the command cp -r ~/Library/Developer/Xcode/UserData/Provisioning\ Profiles/* ~/Library/MobileDevice/Provisioning\ Profiles/ initially seemed to help. However, the profiles automatically disappear from the directory within a few seconds. I continue to encounter the error shown below when trying to run the app:

Screenshot 2024-11-01 at 13 20 21

Xcode 16.0 Sonoma 14.6.1

I'm using this command:

python3 build-system/Make/Make.py \
--cacheDir="$HOME/telegram-bazel-cache" \
    generateProject \
    --configurationPath=build-system/template_minimal_development_configuration.json \
    --xcodeManagedCodesigning

Could anyone provide the correct steps to successfully set up and run the project? I'm encountering difficulties and would appreciate detailed guidance

iosdevelopmentzp avatar Nov 01 '24 12:11 iosdevelopmentzp

@iosdevelopmentzp The proper way would be to use my patch to solve this issue. Copy pasting might not do the work and the files can be removed.

matinzd avatar Nov 02 '24 00:11 matinzd

Showing Recent Messages

Build target TelegramCoreFramework of project Btok with configuration Debug note: Run script build phase 'Copy Bazel Outputs / Generate Bazel Dependencies (Index Build)' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked. (in target 'TelegramCoreFramework' from project 'xxx') error: Unable to discover swiftc command line tool info: Could not parse Swift versions from: (in target 'TelegramCoreFramework' from project 'xxx')

Run script build phase 'Copy Bazel Outputs / Generate Bazel Dependencies (Index Build)' will be run during every build because the option to run the script phase "Based on dependency analysis" is unchecked.

Unable to discover swiftc command line tool info: Could not parse Swift versions from: (in target 'TelegramCoreFramework' from project 'xxx')

Xcode: 16.1 iOS: 18

How to fix it?

UniqueSilence avatar Dec 20 '24 06:12 UniqueSilence

Maybe it will help someone - instructions on how I was able to run this on Simulator:

  1. Clone the project: https://github.com/TelegramMessenger/Telegram-iOS?tab=readme-ov-file#get-the-code

  2. In your user's folder on Mac (in the Users folder in the system (aka $HOME)) create a folder telegram-configuration

  3. Copy the build-system/fake-codesigning folder from the project to the telegram-configuration folder from step 2

  4. Copy build-system/appstore-configuration.json to the telegram-configuration folder from step 2 and rename this file to development-configuration.json

  5. Generate a simulator-only Xcode project as follows: 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

  6. Xcode will open with the generated project. Run the project and then start Simulator, where Telegram will appear.

I hope I didn't miss anything, because I was struggling for a long time, but somehow this method helped me to launch it without any problems with provisioning profile.

Important, if you clone a new version later, don't forget to do steps 3 and 4 again

Just in case: MacOS: 14.6.1 Xcode: 16.2 App Version: 11.6

The idea came from this issue: https://github.com/TelegramMessenger/Telegram-iOS/issues/999

Most likely everything is simpler and it's enough just to use this command after step 1:

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

Alpa-ch avatar Feb 08 '25 22:02 Alpa-ch

Maybe it will help someone - instructions on how I was able to run this on Simulator:

  1. Clone the project: https://github.com/TelegramMessenger/Telegram-iOS?tab=readme-ov-file#get-the-code
  2. In your user's folder on Mac (in the Users folder in the system (aka $HOME)) create a folder telegram-configuration
  3. Copy the build-system/fake-codesigning folder from the project to the telegram-configuration folder from step 2
  4. Copy build-system/appstore-configuration.json to the telegram-configuration folder from step 2 and rename this file to development-configuration.json
  5. Generate a simulator-only Xcode project as follows: 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
  6. Xcode will open with the generated project. Run the project and then start Simulator, where Telegram will appear.

I hope I didn't miss anything, because I was struggling for a long time, but somehow this method helped me to launch it without any problems with provisioning profile.

Important, if you clone a new version later, don't forget to do steps 3 and 4 again

Just in case: MacOS: 14.6.1 Xcode: 16.2 App Version: 11.6

The idea came from this issue: #999

Most likely everything is simpler and it's enough just to use this command after step 1:

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

Saved me, thank you!

You having just a typo with quotes, it should be not curly quotes

Here is the script with fixed quotes

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

shestaya-liniya avatar Feb 14 '25 01:02 shestaya-liniya

Image

hi, maybe someone has encountered this?

mackFucker avatar Aug 30 '25 20:08 mackFucker

/Users/devidkihtenko/Library/Developer/Xcode/DerivedData/Telegram-egivjntzxnlfakfrndoytemupady/Build/Intermediates.noindex/Telegram.build/bazel-out/ios_arm64-dbg-ios-arm64-min13.0-applebin_ios-ST-f0cef7718cc5/bin/submodules/SSignalKit/SwiftSignalKit/SwiftSignalKitFramework/Objects-normal/arm64/SwiftSignalKit.swiftdoc open /Users/devidkihtenko/Library/Developer/Xcode/DerivedData/Telegram-egivjntzxnlfakfrndoytemupady/Build/Products/Debug-iphoneos/bazel-out/ios_arm64-dbg-ios-arm64-min13.0-applebin_ios-ST-f0cef7718cc5/bin/submodules/SSignalKit/SwiftSignalKit/SwiftSignalKitFramework.framework/Modules/SwiftSignalKit.swiftmodule/arm64-apple-ios.swiftdoc: No such file or directory

It's the same mistake for the others. (

mackFucker avatar Aug 30 '25 20:08 mackFucker

@mackFucker check this solution #1785

mullerty avatar Oct 17 '25 12:10 mullerty