AgoraIO-Extensions/Agora-Flutter-RTM-SDK

App Store Connect Upload Failure Invalid Executable. The executable contains bitcode.

Opened this issue · 6 comments

Prepare Build for App Store Connect
Error
Invalid Executable. The executable 'Runner.app/Frameworks/AgoraRtmKit.framework/AgoraRtmKit' contains bitcode.

Note there are workaround available online, eg: https://medium.com/@abdulahad2024/fixing-bitcode-issues-in-xcode-16-how-to-resolve-invalid-executable-errors-when-uploading-ios-da07a5a39c7c

But this should be fixed within the package.

RTM Release: 2.2.1
Flutter: 3.24.3
Xcode: 16.0
macOS: 14.5 Sonoma (Xcode Cloud Environment)

Platforms affected

  • Android
  • iOS
  • macOS
  • Windows
  • Web

Steps to reproduce

When you try to upload the app to App Store Connect using Xcode 16.

Expected results

It should upload without any problems.

Actual results

Prepare Build for App Store Connect
Error
Invalid Executable. The executable 'Runner.app/Frameworks/AgoraRtmKit.framework/AgoraRtmKit' contains bitcode.

Code sample

No response

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.7 23H124 darwin-x64, locale
    en-BD)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.0)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.1)
[✓] IntelliJ IDEA Ultimate Edition (version 2024.2.2)
[✓] VS Code (version 1.94.2)
[✓] Connected device (3 available)
[✓] Network resources

• No issues found!

I had to add this code in the post_install do |installer| block in the pod-file:

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 = [
         "ios/Pods/AgoraRtm_iOS/AgoraRtmKit.xcframework/ios-arm64_armv7/AgoraRtmKit.framework/AgoraRtmKit"
       ]

       framework_paths.each do |framework_relative_path|
         strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
       end

Edit: I'm not sure, but you also might need to run pod update --repo-update --project-directory=ios before running flutter build ios

any update for this issues ?

did you find any solution same bug for me too

me too
bitcode

Hi all
I have checked the information for all binary files of version 2.2.1 and found no Bitcode present. Could you provide the UUID of the AgoraRtmKit.framework that is actually included in your packaged app?

Add this to the end of post_install do |installer| in Podfile

post_install do |installer|

...

  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/AgoraRtm_iOS/AgoraRtmKit.xcframework/ios-arm64_armv7/AgoraRtmKit.framework/AgoraRtmKit",
  ]

  framework_paths.each do |framework_relative_path|
    strip_bitcode_from_framework(bitcode_strip_path, framework_relative_path)
  end

end

and then pod install in the ios directory