Flutter iOS error: GeneratedPluginRegistrant.m: fatal error: module 'package_info' not found

Viewed 1120

In my Flutter project, I target both Android and iOS, and I added the following libraries in my pubspec.yamlfile:

  url_launcher: ^5.7.10
  package_info: ^0.4.3+4

Now, when I run my app in debug mode on an iOS emulator, I got the following error during compile time:

/Users/blabla/MyProject/Developpement/myproject/ios/Runner/GeneratedPluginRegistrant.m:10:9: fatal error: module 'package_info' not found
    @import package_info;
     ~~~~~~~^~~~~~~~~~~~
    1 error generated.

I can see the error in Xcode, when I open GeneratedPluginRegistrant.m:

Error in Xcode

I took a look at that, and maybe the problem comes from the fact that I use a custom Cocoapods file in my project (a custom Podfile), not sure though. The problem is: I need that file to import AWS libraries in my iOS project.

Here is the content of my Podfile:

platform :ios, '12.0'

target 'Runner' do
  use_frameworks!

  pod 'AWSMobileClient'
  pod 'AWSAPIGateway'
  pod 'AWSS3'
end

So how can I fix that problem?

Thanks.

1 Answers

I finally managed to make this work by doing the following:

  1. create a new Flutter project, and add, in pubspec.yaml, the url_launcher and package_info libraries
  2. open the iOS module using Xcode, and open the Podfile
  3. copy the content of that Podfile, and paste it in the Podfile of my current project
  4. move, in the target Runner block of my Podfile project, the already existing libraries (in my case, the 3 AWS libraries)
Related