Desdaemon / flutter_rust_bridge_template

Template for Flutter + Rust integration with flutter_rust_bridge.
https://desdaemon.github.io/flutter_rust_bridge_template/
Apache License 2.0
120 stars 63 forks source link

Pod install error on iOS #56

Closed dragazo closed 11 months ago

dragazo commented 11 months ago

I'm using this template for my new iOS/Android app, which has been really helpful so far. It works perfectly for Android and Linux (desktop), but on iOS I keep getting the following error:

Launching lib/main.dart on Jimmy’s iPad in debug mode...
Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Adding input path to Thin Binary build phase.
Signing iOS app for device deployment using developer identity: "Apple Development: Devin Jean (39ZLGP89YB)"
Running pod install...                                             490ms
CocoaPods' output:
↳
      Preparing

    Analyzing dependencies

    Inspecting targets to integrate
      Using `ARCHS` setting to build architectures of target `Pods-Runner`: (``)
    [!] Unable to find a target named `RunnerTests` in project `Runner.xcodeproj`, did find `Runner`.

    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer/target_inspector.rb:108:in
    `compute_targets'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer/target_inspector.rb:40:in
    `compute_results'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1197:in `block (3 levels) in
    inspect_targets_to_integrate'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1195:in `each'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1195:in `block (2 levels) in
    inspect_targets_to_integrate'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1193:in `each'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1193:in `block in
    inspect_targets_to_integrate'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:1188:in `inspect_targets_to_integrate'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer/analyzer.rb:107:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:422:in `analyze'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/user_interface.rb:64:in `section'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/installer.rb:162:in `install!'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command/install.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/lib/cocoapods/command.rb:52:in `run'
    /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.13.0/bin/pod:55:in `<top (required)>'
    /usr/local/bin/pod:23:in `load'
    /usr/local/bin/pod:23:in `<main>'

Error output from CocoaPods:
↳

    [!] Automatically assigning platform `iOS` with version `11.0` on target `Runner` because no platform was specified.
    Please specify a platform for this target in your Podfile. See
    `https://guides.cocoapods.org/syntax/podfile.html#platform`.

Exception: Error running pod install
error: Recipe `run-on` failed on line 16 with exit code 1

I don't know if this would have any negative side-effects, but this seems to be solvable by removing the following lines from the Podfile:

target 'RunnerTests' do
  inherit! :search_paths
end
dragazo commented 11 months ago

Here's the output of flutter doctor. I'm only missing Android studio, but that's because on this machine I only need to build for iOS - Android works fine on another machine already.

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.13.6, on macOS 13.2 22D49 darwin-arm64, locale en)
[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.

[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Chrome - develop for the web
[!] Android Studio (not installed)
[✓] VS Code (version 1.82.0)
[✓] Connected device (3 available)
[✓] Network resources

! Doctor found issues in 2 categories.
Desdaemon commented 11 months ago

You can try to refresh the template manually via flutter create --platforms=ios . which would generate the missing files. I haven't been working with iOS recently so I didn't catch this, thanks for the notice!

dragazo commented 11 months ago

I tried totally deleting the ios directory and doing that, which didn't work (missing all the rust config). I could try running it without deleting everything, but I'm just satisfied it's finally working (by just removing RunnerTests) lol