embrace-io / embrace-flutter-sdk

Embrace's SDK for Flutter
https://embrace.io/docs/flutter/
Apache License 2.0
93 stars 2 forks source link

[iOS] Swift Compiler Error: No such module 'Embrace' after updating to Embrace Flutter SDK version 3.0.1 and Embrace SDK 6.4.2 #17

Closed JhonaCodes closed 2 weeks ago

JhonaCodes commented 2 weeks ago

Description After updating to Embrace Flutter SDK version 3.0.1 and Embrace SDK 6.4.2, the iOS build fails with a Swift Compiler Error: "No such module 'Embrace'".

I had the same issue as the one mentioned here: https://github.com/embrace-io/embrace-flutter-sdk/issues/11

So, I decided to follow the instructions and upgrade Embrace to the latest version (3.0.1), but now I'm encountering this new problem.

Steps To Reproduce

  1. Update Embrace Flutter SDK to version 3.0.1
  2. Update Embrace SDK to version 6.4.2
  3. Attempt to build the iOS app
  4. See error in Xcode build output

Expected Behavior The iOS app should build successfully without any module-related errors.

Screenshots Image

Additional Context

Error message:

Swift Compiler Error (Xcode): No such module 'Embrace'
/Users/builder/clone/ios/Runner/AppDelegate.swift:2:7

Full build output:

Updating project for Xcode compatibility.
Upgrading project.pbxproj
Upgrading Runner.xcscheme
Running pod install... 1,819ms
Running Xcode build...
Xcode build done. 96.6s
Failed to build iOS app
Swift Compiler Error (Xcode): No such module 'Embrace'
/Users/builder/clone/ios/Runner/AppDelegate.swift:2:7
Encountered error while building for device.
Build failed :|
Failed to build for iOS

On emulator same problem:

[   +1 ms] Swift Compiler Error (Xcode): No such module 'Embrace'
           /xxxxxxxx/ios/Runner/AppDelegate.swift:2:7

[   +1 ms] Could not build the application for the simulator.
[        ] Error launching application on iPhone 16.
[  +19 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:790:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1408:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:420:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:93:3)
           <asynchronous suspension>
[   +2 ms] "flutter run" took 24,165ms.
[ +151 ms] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:790:9)
           <asynchronous suspension>
           #2      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1408:27)
           <asynchronous suspension>
           #3      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #4      CommandRunner.runCommand (package:args/command_runner.dart:212:13)
           <asynchronous suspension>
           #5      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:420:9)
           <asynchronous suspension>
           #6      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #7      FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:364:5)
           <asynchronous suspension>
           #8      run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:130:9)
           <asynchronous suspension>
           #9      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
           <asynchronous suspension>
           #10     main (package:flutter_tools/executable.dart:93:3)
           <asynchronous suspension>

Go Above and Beyond To help reproduce this issue:

  1. Ensure that the ios/Podfile includes:

    platform :ios, '14.0'
  2. Verify that AppDelegate.swift includes:

    import Embrace
  3. Check if running pod update EmbraceIO and pod install in the ios folder completes successfully.

  4. Verify that opening Runner.xcworkspace (not Runner.xcodeproj) still produces the error.

ArielDemarco commented 2 weeks ago

Hey @JhonaCodes , I think the issue is not related. As far as I can see, you're trying to import a non-existent module. The actual module name is EmbraceIO (our "umbrella" import) or, EmbraceCore. The Embrace module/import was for 5.x version. You can check the ios integration guide to see how to integrate with iOS 6.x version (that's the one using Flutter 3.0.1)

ArielDemarco commented 2 weeks ago

Closing the issue as I think it's been resolved. Feel free to open a new one if another problem appears.

JhonaCodes commented 2 weeks ago

@ArielDemarco Well, in the end I had to downgrade Xcode to 15.4, so that it works with Patrol version 2.0.0, because when using the EmbraceIO and EmbraceCore imports, I got errors with references to missing functions.

I hope to have time this week to create the case or report it.

Thanks.