Adding sqflite or path_provider makes Xcode fail with "file not found"

1,037 views
Skip to first unread message

michel....@gmail.com

unread,
Mar 7, 2018, 8:23:13 PM3/7/18
to Flutter Dev
I have started playing with flutter to write an iOS version of an app I have (and possibly replace my Android version with it as well).
However, if I add sqflite or path_provider in my yaml file, I get an error during the Xcode compilation. For example, for sqflite, I get:

Running "flutter packages get" in flutter_app...
Launching lib/main.dart on iPhone X in debug mode...
Running pod install...
Running Xcode clean...
Starting Xcode build...
Xcode build done
Failed to build iOS app
Error output from Xcode build:

    ** BUILD FAILED **
    
Xcode's output:

    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    The use of Swift 3 @objc inference in Swift 4 mode is deprecated. Please address deprecated @objc inference warnings, test your code with “Use of deprecated Swift 3 @objc inference” logging enabled, and then disable inference by changing the "Swift 3 @objc Inference" build setting to "Default" for the "Runner" target.
    === BUILD TARGET Runner OF PROJECT Runner WITH CONFIGURATION Debug ===
    /Users/michel/Development/Androdev/Flutter/flutter_app/ios/Runner/GeneratedPluginRegistrant.m:6:9: fatal error: 'sqflite/SqflitePlugin.h' file not found
    #import <sqflite/SqflitePlugin.h>
            ^~~~~~~~~~~~~~~~~~~~~~~~~
    1 error generated.
Could not build the application for the simulator.
Error launching application on iPhone X.

I have found some reference to this situation on GitHub, but I don't understand the (rather non-detailed) description of the last poster's solution.
What do I need to do to get sqflite to work (and path_provider)? 

Mikkel Ravn

unread,
Mar 8, 2018, 2:14:27 AM3/8/18
to michel....@gmail.com, Flutter Dev
We're tracking this issue in https://github.com/flutter/flutter/issues/15099 which also contains a link to a workaround (manually setting the Target Membership of SqflitePlugin.h to Public in Xcode).

--
You received this message because you are subscribed to the Google Groups "Flutter Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Mikkel Nygaard Ravn
Software Engineer

Michel Lesoinne

unread,
Mar 9, 2018, 1:34:54 PM3/9/18
to Flutter Dev
I am not even seeing the SqflitePlugin.h file. 
To make sure I didn't miss a step, I did the following:
  1. Added sqflite: any  under the dependencies in pubspec.yaml.
  2. Ran 'flutter packages get' in the project base directory
  3. Did 'open ios/Runner.xcworkspace/'
The Podfile does not contain anything about sqflite, but there is a file ./Pods/Local Podspecs/sqflite.podspec.json
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Michel Lesoinne

unread,
Mar 9, 2018, 8:22:18 PM3/9/18
to Flutter Dev
I am not totally sure that I can reproduce it, but I was able to get around the issue. (and another one that appeared as well) 
I commented out one line in the Podfile:
  #use_frameworks!
Then I also had to force the generated pods to target a version of iOS more recent than 8.0. I modified the last few lines to read:

post_install do |installer|

  installer.pods_project.targets.each do |target|

    target.build_configurations.each do |config|

      config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '9.2' # THIS IS THE LINE I ADDED.

      config.build_settings['ENABLE_BITCODE'] = 'NO'

    end

  end

end


Reply all
Reply to author
Forward
0 new messages