Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS app is all broken on Xcode 16 #5877

Open
krishan-kumar-mourya opened this issue Sep 23, 2024 · 9 comments
Open

iOS app is all broken on Xcode 16 #5877

krishan-kumar-mourya opened this issue Sep 23, 2024 · 9 comments

Comments

@krishan-kumar-mourya
Copy link

krishan-kumar-mourya commented Sep 23, 2024

Description:

After upgrading to macOS Sequoia (V 15.0) which comes with Xcode 16 or even upgrading Xcode directly to version 16, the iOS build is all broken with multiple failures.

Environment Information:

  • Rocket.Chat Server Version: NA
  • Rocket.Chat App Version: All
  • Device Name: Macbook
  • OS Version: macOS Sequoia (V 15.0)

Steps to reproduce:

  1. pod install
  2. yarn run ios

modules broken:

  • react-native-image-crop-picker
  • expo-apple-authentication
@niggeulimann
Copy link

there are already two other related tickets: #5886 & #5873
Please upvote for more attention!

@krishan-kumar-mourya
Copy link
Author

krishan-kumar-mourya commented Oct 4, 2024

Until they fix it, here is the workaround that fixed the iOS build

  • Update: patches/@Nozbe+watermelondb+0.25.5.patch

Add below lines at the top of the file

diff --git a/node_modules/@nozbe/watermelondb/WatermelonDB.podspec b/node_modules/@nozbe/watermelondb/WatermelonDB.podspec
index e9fea58..cfc33ee 100644
--- a/node_modules/@nozbe/watermelondb/WatermelonDB.podspec
+++ b/node_modules/@nozbe/watermelondb/WatermelonDB.podspec
@@ -1[4](https://bitbucket.org/patientrials/patientrials-mobile/commits/21f100d98de17c8afc09368063c5e21d49d4d138#Lpatches/@nozbe+watermelondb+0.25.5.patchT4),7 +14,7 @@ Pod::Spec.new do |s|
   s.source = { :git => "https://github.com/Nozbe/WatermelonDB.git", :tag => "v#{s.version}" }
   s.source_files = "native/ios/**/*.{h,m,mm,swift,c,cpp}", "native/shared/**/*.{h,c,cpp}"
   s.public_header_files = [
-    'native/ios/WatermelonDB/SupportingFiles/Bridging.h',
+    'native/ios/**/*.h',
     'native/ios/WatermelonDB/JSIInstaller.h',
   ]
   s.requires_arc = true
  • Bitcode is no longer supported in Xcode 16 so we need to stripe it

Update: ios/Podfile
Add below lines inside post_install block

  bitcode_strip_path = `xcrun --find bitcode_strip`.chop!
  def strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
    framework_path = File.join(Dir.pwd, framework_relative_path)
    command = "#{bitcode_strip_path} #{framework_path} -r -o #{framework_path}"
    puts "Stripping bitcode: #{command}"
    system(command)
  end
  framework_paths = [
    "Pods/FBAEMKit/XCFrameworks/FBAEMKit.xcframework/ios-arm64/FBAEMKit.framework/FBAEMKit",
    "Pods/FBSDKCoreKit/XCFrameworks/FBSDKCoreKit.xcframework/ios-arm64/FBSDKCoreKit.framework/FBSDKCoreKit",
    "Pods/FBSDKCoreKit_Basics/XCFrameworks/FBSDKCoreKit_Basics.xcframework/ios-arm64/FBSDKCoreKit_Basics.framework/FBSDKCoreKit_Basics",
    "Pods/FBSDKGamingServicesKit/XCFrameworks/FBSDKGamingServicesKit.xcframework/ios-arm64/FBSDKGamingServicesKit.framework/FBSDKGamingServicesKit",
    "Pods/FBSDKLoginKit/XCFrameworks/FBSDKLoginKit.xcframework/ios-arm64/FBSDKLoginKit.framework/FBSDKLoginKit",
    "Pods/FBSDKShareKit/XCFrameworks/FBSDKShareKit.xcframework/ios-arm64/FBSDKShareKit.framework/FBSDKShareKit",
    "Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_armv7/OpenSSL.framework/OpenSSL",
  ]
  framework_paths.each do |framework_relative_path|
    strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
  end

Note: You can add or remove items in framework_paths as per your usage

  • Upgrade

"react-native-image-crop-picker": "RocketChat/react-native-image-crop-picker#..." -> "^0.41.2"

"expo-apple-authentication": "^6.3.0" -> "^6.4.2"

  • Run pod install

there will be error about TOCropViewController. Update it with the instruction given in error.

  • Update: ios/Shared/Extensions/WatermelonDB+Extensions.swift

Comment everything inside func query<T: Codable>(raw: SQL, _ args: QueryArgs = []) -> [T] {
and add return []

  • Update: ios/Shared/RocketChat/Database.swift

Comment everything inside func readRoomEncryptionKey(rid: String) -> String? {
and add return nil

Comment everything inside func readRoomEncrypted(rid: String) -> Bool {
and add return false

  • Finally run it

yarn ios

@diegolmello
Copy link
Member

@krishan-kumar-mourya can you contribute with a PR?

@krishan-kumar-mourya
Copy link
Author

@krishan-kumar-mourya can you contribute with a PR?

Ok, I will try to make it soon.

@Alexdc-12
Copy link

@krishan-kumar-mourya i tried using your script to remove bitcode, but i still get an error? any ideas?

Image

@krishan-kumar-mourya
Copy link
Author

@krishan-kumar-mourya i tried using your script to remove bitcode, but i still get an error? any ideas?

Image

@Alexdc-12 you can try following things:

  • You may need to run pod install again after adding the script (add the script at the end)
  • Make sure the path you entered for OpenSSL is correct. For me it was at Pods/OpenSSL-Universal/Frameworks/OpenSSL.xcframework/ios-arm64_armv7/OpenSSL.framework/OpenSSL
  • make sure there is no error in your pod install command otherwise it may not execute the script to remove bitcode

@Alexdc-12
Copy link

Thanks! It's was the pod-install part i was missing! Now archives! Thanks!

@Rohit3523
Copy link
Contributor

It's an issue with expo-apple-authentication because iOS 18 added one more error code which needs to be handled by the switch statement.

To resolve this issue please update expo-apple-authentication to latest version or use xcode 15

expo/expo#31555 (comment)

@Rohit3523
Copy link
Contributor

Also i think core team is currently using xcode 15 and they will update the package once they move into xcode 16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants